Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Oct 8, 2024
1 parent e2afd89 commit 0dbc52f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ def email_field_allowed?
private

def sql_concat_name
fields = [
"users.firstname", "users.lastname",
"users.lastname", "users.firstname",
"users.login"
]
fields = <<~SQL.squish
users.firstname, ' ', users.lastname,
' ',
users.lastname, ' ', users.firstname,
' ',
users.login
SQL

fields << "users.mail" if email_field_allowed?
fields << ", ' ',users.mail" if email_field_allowed?

<<~SQL.squish
LOWER(CONCAT_WS(#{fields.join(',')}))
LOWER(CONCAT(#{fields}))
SQL
end
end
Expand Down
1 change: 1 addition & 0 deletions modules/team_planner/spec/features/query_handling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
require_relative "../../../../spec/features/views/shared_examples"

RSpec.describe "Team planner query handling", :js, :with_cuprite, with_ee: %i[team_planner_view] do
shared_let(:standard) { create(:standard_global_role) }
shared_let(:type_task) { create(:type_task) }
shared_let(:type_bug) { create(:type_bug) }
shared_let(:project) do
Expand Down
1 change: 1 addition & 0 deletions modules/team_planner/spec/features/shared_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
require_relative "../support/pages/team_planner"

RSpec.shared_context "with team planner full access" do
shared_let(:standard) { create(:standard_global_role) }
shared_let(:project) do
create(:project)
end
Expand Down
1 change: 1 addition & 0 deletions spec/factories/global_role_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
name { "Standard global role" }
builtin { Role::BUILTIN_STANDARD_GLOBAL }
initialize_with { GlobalRole.where(builtin: Role::BUILTIN_STANDARD_GLOBAL).first_or_initialize }
permissions { [:view_user_email] }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
let!(:second_version) { create(:version, name: "Version 2", project:) }
let!(:third_version) { create(:version, name: "Version 3", project:) }

shared_let(:standard) { create(:standard_global_role) }
shared_let(:reader_role_without_project_attributes) do
create(:project_role, permissions: %i[view_work_packages])
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require "spec_helper"

RSpec.describe "Invite user modal", :js, :with_cuprite do
shared_let(:standard) { create(:standard_global_role) }
shared_let(:project) { create(:project) }
shared_let(:work_package) { create(:work_package, project:) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require "spec_helper"

RSpec.describe "Inviting user in project the current user is lacking permission in", :js, :with_cuprite do
shared_let(:standard) { create(:standard_global_role) }
let(:modal) do
Components::Users::InviteUserModal.new project: invite_project,
principal: other_user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require "spec_helper"

RSpec.describe "Invite user modal subprojects", :js, :with_cuprite do
shared_let(:standard) { create(:standard_global_role) }
shared_let(:project) { create(:project, name: "Parent project") }
shared_let(:subproject) { create(:project, name: "Subproject", parent: project) }
shared_let(:work_package) { create(:work_package, project: subproject) }
Expand Down

0 comments on commit 0dbc52f

Please sign in to comment.