diff --git a/app/models/hyrax/model_registry.rb b/app/models/hyrax/model_registry.rb index 6e6e219e2c..b11550edb7 100644 --- a/app/models/hyrax/model_registry.rb +++ b/app/models/hyrax/model_registry.rb @@ -99,7 +99,7 @@ def self.work_rdf_representations end def self.classes_from(strings) - strings.map(&:safe_constantize).flatten.uniq + strings.map(&:safe_constantize).compact.uniq end private_class_method :classes_from diff --git a/spec/models/hyrax/model_registry_spec.rb b/spec/models/hyrax/model_registry_spec.rb index 6eb31ab287..567fd2f784 100644 --- a/spec/models/hyrax/model_registry_spec.rb +++ b/spec/models/hyrax/model_registry_spec.rb @@ -29,4 +29,11 @@ it { is_expected.to all(be_kind_of(String)) } end end + + describe ".classes_from" do + subject { described_class.send("classes_from", ["DefinitelyNotARealClass", "Hyrax"]) } + + it { is_expected.to be_a(Array) } + it { is_expected.not_to include(nil) } + end end