File tree 2 files changed +20
-1
lines changed
lib/hyrax/specs/shared_specs
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 18
18
describe '#to_solr' do
19
19
it 'indexes base resource fields' do
20
20
expect ( indexer . to_solr )
21
- . to include ( has_model_ssim : resource . class . name ,
21
+ . to include ( has_model_ssim : resource . to_rdf_representation ,
22
22
human_readable_type_tesim : resource . human_readable_type ,
23
23
alternate_ids_sim : a_collection_containing_exactly ( *ids ) )
24
24
end
Original file line number Diff line number Diff line change @@ -66,6 +66,25 @@ def ci_build?
66
66
:fixture_disk
67
67
)
68
68
69
+ # Because we're relying on shared specs from Valkyrie, and assuming that all of the classes will
70
+ # respond to #to_rdf_representation and the base Valkyrie::Resource does not do that nor does the
71
+ # dynamic classes generated for the shared specs; we need the following coercion.
72
+ module Hyrax ::Resource ::Coercible
73
+ extend ActiveSupport ::Concern
74
+
75
+ class_methods do
76
+ def to_rdf_representation
77
+ name . to_s
78
+ end
79
+ end
80
+
81
+ def to_rdf_representation
82
+ self . class . to_rdf_representation
83
+ end
84
+ end
85
+
86
+ Valkyrie ::Resource . include ( Hyrax ::Resource ::Coercible )
87
+
69
88
# Require supporting ruby files from spec/support/ and subdirectories. Note: engine, not Rails.root context.
70
89
Dir [ File . join ( File . dirname ( __FILE__ ) , "support/**/*.rb" ) ] . each { |f | require f }
71
90
You can’t perform that action at this time.
0 commit comments