diff --git a/app/seeders/basic_data/color_seeder.rb b/app/seeders/basic_data/color_seeder.rb index 225c372b704d..760ec3ed6cf5 100644 --- a/app/seeders/basic_data/color_seeder.rb +++ b/app/seeders/basic_data/color_seeder.rb @@ -29,6 +29,7 @@ module BasicData class ColorSeeder < ModelSeeder self.model_class = Color self.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.rb index f3813a98e8c2..13f9726bfe39 100644 --- a/app/seeders/source/seed_data.rb +++ b/app/seeders/source/seed_data.rb @@ -60,7 +60,10 @@ def find_reference(reference, *fallbacks, default: :__unset__) default else references = [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? + STRING raise ArgumentError, message end end diff --git a/modules/bim/app/seeders/bim/basic_data_seeder.rb b/modules/bim/app/seeders/bim/basic_data_seeder.rb index fd404d89db3b..a8ec9238e1d0 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 @@ def data_seeder_classes ::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.rb index c86d87d6be32..9227a4424642 100644 --- a/spec/seeders/root_seeder_standard_edition_spec.rb +++ b/spec/seeders/root_seeder_standard_edition_spec.rb @@ -63,6 +63,7 @@ expect(VersionSetting.count).to eq 4 expect(Boards::Grid.count).to eq 5 expect(Boards::Grid.count { |grid| grid.options.has_key?(:filters) }).to eq 1 + expect(LifeCycle.count).to eq 4 end it "links work packages to their version" do @@ -171,6 +172,7 @@ expect(Version.count).to eq 4 expect(VersionSetting.count).to eq 4 expect(Boards::Grid.count).to eq 5 + expect(LifeCycle.count).to eq 4 end end end diff --git a/spec/seeders/source/seed_data_spec.rb b/spec/seeders/source/seed_data_spec.rb index 2e701c2376e7..7da540555b92 100644 --- a/spec/seeders/source/seed_data_spec.rb +++ b/spec/seeders/source/seed_data_spec.rb @@ -62,11 +62,11 @@ it "raises an error if the reference is not found" do expect { 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/) end it "returns the given default value if the reference is not found" do