Skip to content

Commit

Permalink
Add failing specs for seed_admin_user_enabled=false
Browse files Browse the repository at this point in the history
  • Loading branch information
cbliard committed Nov 26, 2024
1 parent e0104a4 commit 0cfab1e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,31 @@ def group_name(reference)

include_examples "no email deliveries"
end

context "when admin user creation is disabled with OPENPROJECT_SEED_ADMIN_USER_ENABLED=false",
:settings_reset do
shared_let(:root_seeder) { described_class.new }

before_all do
with_env("OPENPROJECT_SEED_ADMIN_USER_ENABLED" => "false") do
with_edition("bim") do
reset(:seed_admin_user_enabled)
root_seeder.seed_data!
end
end
end

it "creates the system user" do
expect(SystemUser.where(admin: true).count).to eq 1
end

it "does not create an admin user" do
expect(User.not_builtin.where(admin: true).count).to eq 0
end

it "seeds without any errors" do
expect(Project.count).to eq 4
expect(WorkPackage.count).to eq 76
end
end
end
27 changes: 27 additions & 0 deletions spec/seeders/root_seeder_standard_edition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,31 @@

include_examples "no email deliveries"
end

context "when admin user creation is disabled with OPENPROJECT_SEED_ADMIN_USER_ENABLED=false",
:settings_reset do
shared_let(:root_seeder) { described_class.new }

before_all do
with_env("OPENPROJECT_SEED_ADMIN_USER_ENABLED" => "false") do
with_edition("standard") do
reset(:seed_admin_user_enabled)
root_seeder.seed_data!
end
end
end

it "creates the system user" do
expect(SystemUser.where(admin: true).count).to eq 1
end

it "does not create an admin user" do
expect(User.not_builtin.where(admin: true).count).to eq 0
end

it "seeds without any errors" do
expect(Project.count).to eq 2
expect(WorkPackage.count).to eq 36
end
end
end

0 comments on commit 0cfab1e

Please sign in to comment.