OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix spec by setting ColorSeeder.attribute_names_for_lookups to allow existing colors to be looked up
Dombi Attilae056fbc5219a
diff --git a/app/seeders/basic_data/color_seeder.rb b/app/seeders/basic_data/color_seeder.rbindex 225c372b704..760ec3ed6cf 100644--- a/app/seeders/basic_data/color_seeder.rb+++ b/app/seeders/basic_data/color_seeder.rb@@ -29,6 +29,7 @@ module BasicDataclass ColorSeeder < ModelSeederself.model_class = Colorself.seed_data_model_key = "colors"+ self.attribute_names_for_lookups = %i[name]def model_attributes(color_data){diff --git a/app/seeders/source/seed_data.rb b/app/seeders/source/seed_data.rbindex f3813a98e8c..13f9726bfe3 100644--- a/app/seeders/source/seed_data.rb+++ b/app/seeders/source/seed_data.rb@@ -60,7 +60,10 @@ class Source::SeedDatadefaultelsereferences = [reference, *fallbacks].map(&:inspect)- message = "Nothing registered with #{'reference'.pluralize(references.count)} #{references.to_sentence(locale: false)}"+ message = <<~STRING+ Nothing registered with #{'reference'.pluralize(references.count)} #{references.to_sentence(locale: false)}+ Perhaps you forgot to add the `attribute_names_for_lookups` for your seeder?+ STRINGraise ArgumentError, messageendenddiff --git a/modules/bim/app/seeders/bim/basic_data_seeder.rb b/modules/bim/app/seeders/bim/basic_data_seeder.rbindex fd404d89db3..a8ec9238e1d 100644--- a/modules/bim/app/seeders/bim/basic_data_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data_seeder.rb@@ -37,6 +37,7 @@ module Bim::BasicData::TimeEntryActivitySeeder,::BasicData::ColorSeeder,::BasicData::ColorSchemeSeeder,+ ::BasicData::LifeCycleSeeder,::BasicData::WorkflowSeeder,::BasicData::PrioritySeeder,::Bim::BasicData::SettingSeeder,diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rbindex c86d87d6be3..9227a442464 100644--- a/spec/seeders/root_seeder_standard_edition_spec.rb+++ b/spec/seeders/root_seeder_standard_edition_spec.rb@@ -63,6 +63,7 @@ RSpec.describe RootSeeder,expect(VersionSetting.count).to eq 4expect(Boards::Grid.count).to eq 5expect(Boards::Grid.count { |grid| grid.options.has_key?(:filters) }).to eq 1+ expect(LifeCycle.count).to eq 4endit "links work packages to their version" do@@ -171,6 +172,7 @@ RSpec.describe RootSeeder,expect(Version.count).to eq 4expect(VersionSetting.count).to eq 4expect(Boards::Grid.count).to eq 5+ expect(LifeCycle.count).to eq 4endendenddiff --git a/spec/seeders/source/seed_data_spec.rb b/spec/seeders/source/seed_data_spec.rbindex 2e701c2376e..7da540555b9 100644--- a/spec/seeders/source/seed_data_spec.rb+++ b/spec/seeders/source/seed_data_spec.rb@@ -62,11 +62,11 @@ RSpec.describe Source::SeedData doit "raises an error if the reference is not found" doexpect { seed_data.find_reference(:ref) }- .to raise_error(ArgumentError, "Nothing registered with reference :ref")+ .to raise_error(ArgumentError, /Nothing registered with reference :ref/)expect { seed_data.find_reference(:ref, :other_ref) }- .to raise_error(ArgumentError, "Nothing registered with references :ref and :other_ref")+ .to raise_error(ArgumentError, /Nothing registered with references :ref and :other_ref/)expect { seed_data.find_reference(:ref, :other_ref, :yet_another_ref) }- .to raise_error(ArgumentError, "Nothing registered with references :ref, :other_ref, and :yet_another_ref")+ .to raise_error(ArgumentError, /Nothing registered with references :ref, :other_ref, and :yet_another_ref/)endit "returns the given default value if the reference is not found" do