active-fedora 7.3.1 → 8.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +17 -7
- data/Gemfile +0 -3
- data/active-fedora.gemspec +5 -5
- data/gemfiles/rails3.gemfile +5 -0
- data/gemfiles/rails4.1.gemfile +5 -0
- data/gemfiles/rails4.gemfile +5 -0
- data/lib/active_fedora.rb +1 -1
- data/lib/active_fedora/associations/belongs_to_association.rb +8 -21
- data/lib/active_fedora/attributes.rb +13 -12
- data/lib/active_fedora/base.rb +1 -1
- data/lib/active_fedora/datastream.rb +3 -6
- data/lib/active_fedora/indexing.rb +1 -1
- data/lib/active_fedora/om_datastream.rb +1 -5
- data/lib/active_fedora/predicates.rb +2 -2
- data/lib/active_fedora/rdf.rb +6 -2
- data/lib/active_fedora/rdf/fcrepo.rb +326 -0
- data/lib/active_fedora/rdf/identifiable.rb +6 -3
- data/lib/active_fedora/rdf/indexing.rb +3 -15
- data/lib/active_fedora/rdf/persistence.rb +33 -0
- data/lib/active_fedora/rdf/project_hydra.rb +12 -0
- data/lib/active_fedora/rdf/rdf_datastream.rb +33 -15
- data/lib/active_fedora/rdf_xml_writer.rb +2 -2
- data/lib/active_fedora/relationship_graph.rb +8 -8
- data/lib/active_fedora/semantic_node.rb +3 -15
- data/lib/active_fedora/solr_digital_object.rb +2 -2
- data/lib/active_fedora/solr_service.rb +1 -8
- data/lib/active_fedora/version.rb +1 -1
- data/lib/generators/active_fedora/config/fedora/templates/fedora.yml +24 -0
- data/lib/tasks/active_fedora_dev.rake +1 -1
- data/spec/integration/belongs_to_association_spec.rb +0 -5
- data/spec/integration/json_serialization_spec.rb +1 -1
- data/spec/integration/load_from_solr_spec.rb +8 -1
- data/spec/integration/ntriples_datastream_spec.rb +18 -18
- data/spec/integration/om_datastream_spec.rb +2 -2
- data/spec/integration/rdf_nested_attributes_spec.rb +1 -1
- data/spec/integration/relation_delegation_spec.rb +3 -3
- data/spec/samples/hydra-mods_article_datastream.rb +0 -4
- data/spec/support/an_active_model.rb +0 -4
- data/spec/unit/active_fedora_spec.rb +3 -3
- data/spec/unit/attributes_spec.rb +37 -54
- data/spec/unit/base_extra_spec.rb +0 -9
- data/spec/unit/om_datastream_spec.rb +14 -14
- data/spec/unit/rdf_resource_datastream_spec.rb +59 -9
- data/spec/unit/rdf_vocab_spec.rb +30 -0
- data/spec/unit/solr_digital_object_spec.rb +2 -2
- data/spec/unit/solr_service_spec.rb +0 -6
- data/spec/unit/validations_spec.rb +4 -4
- metadata +27 -32
- data/lib/active_fedora/rdf/object_resource.rb +0 -20
@@ -15,7 +15,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
15
15
|
index.type :date
|
16
16
|
index.as :stored_searchable, :sortable
|
17
17
|
end
|
18
|
-
property :
|
18
|
+
property :filesize, predicate: FileVocabulary.size do |index|
|
19
19
|
index.type :integer
|
20
20
|
index.as :stored_sortable
|
21
21
|
end
|
@@ -26,7 +26,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
26
26
|
class RdfTest < ActiveFedora::Base
|
27
27
|
has_metadata 'rdf', type: MyDatastream
|
28
28
|
has_attributes :based_near, :related_url, :part, :date_uploaded, datastream: 'rdf', multiple: true
|
29
|
-
has_attributes :title, :
|
29
|
+
has_attributes :title, :filesize, datastream: 'rdf', multiple: false
|
30
30
|
end
|
31
31
|
@subject = RdfTest.new
|
32
32
|
end
|
@@ -74,16 +74,16 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
74
74
|
|
75
75
|
describe "serializing" do
|
76
76
|
it "should handle dates" do
|
77
|
-
subject.date_uploaded = Date.parse('2012-11-02')
|
77
|
+
subject.date_uploaded = [Date.parse('2012-11-02')]
|
78
78
|
subject.date_uploaded.first.should be_kind_of Date
|
79
79
|
solr_document = subject.to_solr
|
80
80
|
solr_document[ActiveFedora::SolrService.solr_name('rdf__date_uploaded', type: :date)].should == ['2012-11-02T00:00:00Z']
|
81
81
|
end
|
82
82
|
it "should handle integers" do
|
83
|
-
subject.
|
84
|
-
subject.
|
83
|
+
subject.filesize = 12345
|
84
|
+
subject.filesize.should be_kind_of Fixnum
|
85
85
|
solr_document = subject.to_solr
|
86
|
-
solr_document[ActiveFedora::SolrService.solr_name('
|
86
|
+
solr_document[ActiveFedora::SolrService.solr_name('rdf__filesize', :stored_sortable, type: :integer)].should == '12345'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -97,9 +97,9 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
97
97
|
it "should set and recall values" do
|
98
98
|
@subject.title = 'War and Peace'
|
99
99
|
@subject.rdf.should be_changed
|
100
|
-
@subject.based_near = "Moscow, Russia"
|
101
|
-
@subject.related_url = "http://en.wikipedia.org/wiki/War_and_Peace"
|
102
|
-
@subject.part = "this is a part"
|
100
|
+
@subject.based_near = ["Moscow, Russia"]
|
101
|
+
@subject.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
102
|
+
@subject.part = ["this is a part"]
|
103
103
|
@subject.save
|
104
104
|
@subject.title.should == 'War and Peace'
|
105
105
|
@subject.based_near.should == ["Moscow, Russia"]
|
@@ -108,9 +108,9 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
108
108
|
end
|
109
109
|
it "should set, persist, and recall values" do
|
110
110
|
@subject.title = 'War and Peace'
|
111
|
-
@subject.based_near = "Moscow, Russia"
|
112
|
-
@subject.related_url = "http://en.wikipedia.org/wiki/War_and_Peace"
|
113
|
-
@subject.part = "this is a part"
|
111
|
+
@subject.based_near = ["Moscow, Russia"]
|
112
|
+
@subject.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
113
|
+
@subject.part = ["this is a part"]
|
114
114
|
@subject.save
|
115
115
|
|
116
116
|
loaded = RdfTest.find(@subject.pid)
|
@@ -127,7 +127,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
127
127
|
loaded.part.should == ['part 1', 'part 2']
|
128
128
|
end
|
129
129
|
it "should append values" do
|
130
|
-
@subject.part = "thing 1"
|
130
|
+
@subject.part = ["thing 1"]
|
131
131
|
@subject.save
|
132
132
|
|
133
133
|
@subject.part << "thing 2"
|
@@ -152,7 +152,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
152
152
|
# reopening existing class
|
153
153
|
class MyDatastream < ActiveFedora::NtriplesRDFDatastream
|
154
154
|
rdf_subject { |ds| RDF::URI.new("http://oregondigital.org/ns/#{ds.pid.split(':')[1]}") }
|
155
|
-
property :
|
155
|
+
property :dctype, predicate: RDF::DC.type
|
156
156
|
property :spatial, predicate: RDF::DC.spatial
|
157
157
|
end
|
158
158
|
end
|
@@ -162,11 +162,11 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
162
162
|
|
163
163
|
it "should write rdf with proper subjects" do
|
164
164
|
@subject.inner_object.pid = 'test:99'
|
165
|
-
@subject.rdf.
|
165
|
+
@subject.rdf.dctype = "Frog"
|
166
166
|
@subject.save!
|
167
167
|
@subject.reload
|
168
168
|
@subject.rdf.graph.dump(:ntriples).should == "<http://oregondigital.org/ns/99> <http://purl.org/dc/terms/type> \"Frog\" .\n"
|
169
|
-
@subject.rdf.
|
169
|
+
@subject.rdf.dctype == ['Frog']
|
170
170
|
|
171
171
|
end
|
172
172
|
|
@@ -175,7 +175,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
175
175
|
|
176
176
|
it "should delete values" do
|
177
177
|
@subject.title = "Hamlet"
|
178
|
-
@subject.related_url = "http://psu.edu/"
|
178
|
+
@subject.related_url = ["http://psu.edu/"]
|
179
179
|
@subject.related_url << "http://projecthydra.org/"
|
180
180
|
|
181
181
|
@subject.title.should == "Hamlet"
|
@@ -192,7 +192,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
192
192
|
@subject.related_url.should == ["http://psu.edu/"]
|
193
193
|
end
|
194
194
|
it "should delete multiple values at once" do
|
195
|
-
@subject.part = "MacBeth"
|
195
|
+
@subject.part = ["MacBeth"]
|
196
196
|
@subject.part << "Hamlet"
|
197
197
|
@subject.part << "Romeo & Juliet"
|
198
198
|
@subject.part.first.should == "MacBeth"
|
@@ -30,11 +30,11 @@ describe ActiveFedora::OmDatastream do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should not be changed when no fields have been set" do
|
33
|
-
@obj.descMetadata.should_not
|
33
|
+
@obj.descMetadata.should_not be_content_changed
|
34
34
|
end
|
35
35
|
it "should be changed when a field has been set" do
|
36
36
|
@obj.descMetadata.title = 'Foobar'
|
37
|
-
@obj.descMetadata.should
|
37
|
+
@obj.descMetadata.should be_content_changed
|
38
38
|
end
|
39
39
|
describe "#changed?" do
|
40
40
|
it "should not be changed if the new xml matches the old xml" do
|
@@ -147,7 +147,7 @@ describe "Nesting attribute behavior of RDFDatastream" do
|
|
147
147
|
property :parts, predicate: RDF::DC.hasPart, :class_name=>'Component'
|
148
148
|
accepts_nested_attributes_for :parts, allow_destroy: true
|
149
149
|
|
150
|
-
class Component <
|
150
|
+
class Component < ActiveTriples::Resource
|
151
151
|
property :label, predicate: RDF::DC.title
|
152
152
|
end
|
153
153
|
end
|
@@ -29,9 +29,9 @@ describe ActiveFedora::Model do
|
|
29
29
|
|
30
30
|
|
31
31
|
describe "with multiple objects" do
|
32
|
-
let!(:instance1){ ModelIntegrationSpec::Basic.create!(:
|
33
|
-
let!(:instance2){ ModelIntegrationSpec::Basic.create!(:
|
34
|
-
let!(:instance3){ ModelIntegrationSpec::Basic.create!(:
|
32
|
+
let!(:instance1){ ModelIntegrationSpec::Basic.create!(foo: ['Beta'], bar: ['Chips'])}
|
33
|
+
let!(:instance2){ ModelIntegrationSpec::Basic.create!(foo: ['Alpha'], bar: ['Peanuts'])}
|
34
|
+
let!(:instance3){ ModelIntegrationSpec::Basic.create!(foo: ['Sigma'], bar: ['Peanuts'])}
|
35
35
|
|
36
36
|
after { ModelIntegrationSpec::Basic.delete_all }
|
37
37
|
|
@@ -112,8 +112,8 @@ describe ActiveFedora do
|
|
112
112
|
end
|
113
113
|
it "should return class constants based on strings" do
|
114
114
|
ActiveFedora.class_from_string("Om").should == Om
|
115
|
-
ActiveFedora.class_from_string("ActiveFedora::
|
116
|
-
ActiveFedora.class_from_string("
|
115
|
+
ActiveFedora.class_from_string("ActiveFedora::RDF::Indexing").should == ActiveFedora::RDF::Indexing
|
116
|
+
ActiveFedora.class_from_string("Indexing", ActiveFedora::RDF).should == ActiveFedora::RDF::Indexing
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should find sibling classes" do
|
@@ -123,7 +123,7 @@ describe ActiveFedora do
|
|
123
123
|
it "should raise a NameError if the class isn't found" do
|
124
124
|
expect {
|
125
125
|
ActiveFedora.class_from_string("FooClass", ParentClass::OtherSiblingClass)
|
126
|
-
}.to raise_error NameError,
|
126
|
+
}.to raise_error NameError, "uninitialized constant FooClass"
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -99,52 +99,35 @@ describe ActiveFedora::Base do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
ActiveFedora::Attributes.deprecation_behavior = @behavior
|
109
|
-
end
|
110
|
-
it "should deprecate passing a string to a multiple attribute writer" do
|
111
|
-
expect { subject.fubar = "Quack" }.to raise_error
|
112
|
-
expect { subject.fubar = ["Quack"] }.not_to raise_error
|
113
|
-
expect { subject.fubar = nil }.not_to raise_error
|
114
|
-
end
|
115
|
-
it "should deprecate passing an enumerable to a unique attribute writer" do
|
116
|
-
expect { subject.cow = "Low" }.not_to raise_error
|
117
|
-
expect { subject.cow = ["Low"] }.to raise_error
|
118
|
-
expect { subject.cow = nil }.not_to raise_error
|
119
|
-
end
|
102
|
+
it "should raise an exception when passing a string to a multiple attribute writer" do
|
103
|
+
expect { subject.fubar = "Quack" }.to raise_error
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should raise an exception when passing an enumerable to a unique attribute writer" do
|
107
|
+
expect { subject.cow = ["Low"] }.to raise_error
|
120
108
|
end
|
121
109
|
|
122
110
|
it "should reveal the unique properties" do
|
123
|
-
BarHistory2.unique?(:horse).should
|
124
|
-
BarHistory2.unique?(:pig).should
|
125
|
-
BarHistory2.unique?(:cow).should
|
111
|
+
BarHistory2.unique?(:horse).should be false
|
112
|
+
BarHistory2.unique?(:pig).should be true
|
113
|
+
BarHistory2.unique?(:cow).should be true
|
126
114
|
end
|
127
115
|
|
128
116
|
it "should save a delegated property uniquely" do
|
129
|
-
subject.fubar="Quack"
|
117
|
+
subject.fubar = ["Quack"]
|
130
118
|
subject.fubar.should == ["Quack"]
|
131
119
|
subject.withText.get_values(:fubar).first.should == 'Quack'
|
132
|
-
subject.cow="Low"
|
120
|
+
subject.cow = "Low"
|
133
121
|
subject.cow.should == "Low"
|
134
122
|
subject.xmlish.term_values(:cow).first.should == 'Low'
|
135
123
|
|
136
|
-
subject.pig="Oink"
|
124
|
+
subject.pig = "Oink"
|
137
125
|
subject.pig.should == "Oink"
|
138
126
|
end
|
139
127
|
|
140
128
|
it "should allow passing parameters to the delegate accessor" do
|
141
|
-
subject.
|
142
|
-
subject.
|
143
|
-
end
|
144
|
-
|
145
|
-
it "should return a single value if not marked as multiple" do
|
146
|
-
subject.cow=["one", "two"]
|
147
|
-
subject.cow.should == "one"
|
129
|
+
subject.fubar = ["one", "two"]
|
130
|
+
subject.fubar(1).should == ['two']
|
148
131
|
end
|
149
132
|
|
150
133
|
it "should return an array if marked as multiple" do
|
@@ -153,49 +136,49 @@ describe ActiveFedora::Base do
|
|
153
136
|
end
|
154
137
|
|
155
138
|
it "should be able to delegate deeply into the terminology" do
|
156
|
-
subject.duck=["Quack", "Peep"]
|
139
|
+
subject.duck = ["Quack", "Peep"]
|
157
140
|
subject.duck.should == ["Quack", "Peep"]
|
158
141
|
end
|
159
142
|
|
160
143
|
it "should be able to track change status" do
|
161
|
-
subject.fubar_changed?.should
|
162
|
-
subject.fubar = "Meow"
|
163
|
-
subject.fubar_changed?.should
|
144
|
+
subject.fubar_changed?.should be false
|
145
|
+
subject.fubar = ["Meow"]
|
146
|
+
subject.fubar_changed?.should be true
|
164
147
|
end
|
165
148
|
|
166
149
|
describe "array getters and setters" do
|
167
150
|
it "should accept symbol keys" do
|
168
|
-
subject[:duck]= ["Cluck", "Gobble"]
|
151
|
+
subject[:duck] = ["Cluck", "Gobble"]
|
169
152
|
subject[:duck].should == ["Cluck", "Gobble"]
|
170
153
|
end
|
171
154
|
|
172
155
|
it "should accept string keys" do
|
173
|
-
subject['duck']= ["Cluck", "Gobble"]
|
156
|
+
subject['duck'] = ["Cluck", "Gobble"]
|
174
157
|
subject['duck'].should == ["Cluck", "Gobble"]
|
175
158
|
end
|
176
159
|
|
177
160
|
it "should accept field names with _id that are not associations" do
|
178
|
-
subject['animal_id'] =
|
179
|
-
subject['animal_id'].should ==
|
161
|
+
subject['animal_id'] = "lemur"
|
162
|
+
subject['animal_id'].should == "lemur"
|
180
163
|
end
|
181
164
|
|
182
165
|
it "should raise an error on the reader when the field isn't delegated" do
|
183
|
-
expect {subject['goose'] }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
166
|
+
expect { subject['goose'] }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
184
167
|
end
|
185
168
|
|
186
169
|
it "should raise an error on the setter when the field isn't delegated" do
|
187
|
-
expect {subject['goose']="honk" }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
170
|
+
expect {subject['goose'] = "honk" }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
188
171
|
end
|
189
172
|
end
|
190
173
|
|
191
174
|
describe "attributes=" do
|
192
175
|
it "should raise an error on an invalid attribute" do
|
193
|
-
expect {subject.attributes = {'goose'=>"honk" }}.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
176
|
+
expect { subject.attributes = { 'goose'=>"honk" } }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
|
194
177
|
end
|
195
178
|
end
|
196
179
|
|
197
180
|
describe "attributes" do
|
198
|
-
let(:vals) { {'cow'=>
|
181
|
+
let(:vals) { {'cow'=>"moo", 'pig'=>'oink', 'horse'=>['neigh'], "fubar"=>[], 'duck'=>['quack'], 'animal_id'=>nil } }
|
199
182
|
before { subject.attributes = vals }
|
200
183
|
it "should return a hash" do
|
201
184
|
expect(subject.attributes).to eq(vals.merge('id' => nil))
|
@@ -222,14 +205,14 @@ describe ActiveFedora::Base do
|
|
222
205
|
subject { BarHistory3.new }
|
223
206
|
|
224
207
|
it "should be able to delegate deeply into the terminology" do
|
225
|
-
subject.donkey=["Bray", "Hee-haw"]
|
208
|
+
subject.donkey = ["Bray", "Hee-haw"]
|
226
209
|
subject.donkey.should == ["Bray", "Hee-haw"]
|
227
210
|
end
|
228
211
|
|
229
212
|
it "should be able to track change status" do
|
230
|
-
subject.cow_changed?.should
|
213
|
+
subject.cow_changed?.should be false
|
231
214
|
subject.cow = ["Moo"]
|
232
|
-
subject.cow_changed?.should
|
215
|
+
subject.cow_changed?.should be true
|
233
216
|
end
|
234
217
|
end
|
235
218
|
|
@@ -254,16 +237,16 @@ describe ActiveFedora::Base do
|
|
254
237
|
|
255
238
|
describe "with a multivalued field" do
|
256
239
|
it "should be able to track change status" do
|
257
|
-
subject.title_changed?.should
|
240
|
+
subject.title_changed?.should be false
|
258
241
|
subject.title = ["Title1", "Title2"]
|
259
|
-
subject.title_changed?.should
|
242
|
+
subject.title_changed?.should be true
|
260
243
|
end
|
261
244
|
end
|
262
245
|
describe "with a single-valued field" do
|
263
246
|
it "should be able to track change status" do
|
264
|
-
subject.description_changed?.should
|
265
|
-
subject.description = "A brief description"
|
266
|
-
subject.description_changed?.should
|
247
|
+
subject.description_changed?.should be false
|
248
|
+
subject.description = ["A brief description"]
|
249
|
+
subject.description_changed?.should be true
|
267
250
|
end
|
268
251
|
end
|
269
252
|
end
|
@@ -278,10 +261,10 @@ describe ActiveFedora::Base do
|
|
278
261
|
Object.send(:remove_const, :BarHistory4)
|
279
262
|
end
|
280
263
|
|
281
|
-
subject { BarHistory4}
|
264
|
+
subject { BarHistory4 }
|
282
265
|
|
283
266
|
it "should raise an error" do
|
284
|
-
expect {subject.has_attributes :title, :description, multiple: true}.to raise_error
|
267
|
+
expect { subject.has_attributes :title, :description, multiple: true }.to raise_error
|
285
268
|
end
|
286
269
|
end
|
287
270
|
|
@@ -303,7 +286,7 @@ describe ActiveFedora::Base do
|
|
303
286
|
end
|
304
287
|
|
305
288
|
it "should raise an error on set" do
|
306
|
-
expect {subject.description = 'Neat'}.to raise_error(ArgumentError, "Undefined datastream id: `rdfish' in has_attributes")
|
289
|
+
expect {subject.description = ['Neat']}.to raise_error(ArgumentError, "Undefined datastream id: `rdfish' in has_attributes")
|
307
290
|
end
|
308
291
|
end
|
309
292
|
|
@@ -70,15 +70,6 @@ describe ActiveFedora::Base do
|
|
70
70
|
|
71
71
|
end
|
72
72
|
|
73
|
-
describe '#pids_from_uris' do
|
74
|
-
it "should strip the info:fedora/ out of a given string" do
|
75
|
-
ActiveFedora::Base.pids_from_uris("info:fedora/FOOBAR").should == "FOOBAR"
|
76
|
-
end
|
77
|
-
it "should accept an array of strings"do
|
78
|
-
ActiveFedora::Base.pids_from_uris(["info:fedora/FOOBAR", "info:fedora/BAZFOO"]).should == ["FOOBAR", "BAZFOO"]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
73
|
describe "to_class_uri" do
|
83
74
|
before :all do
|
84
75
|
module SpecModel
|
@@ -10,12 +10,12 @@ describe ActiveFedora::OmDatastream do
|
|
10
10
|
}
|
11
11
|
@sample_raw_xml = "<foo><xmlelement/></foo>"
|
12
12
|
@solr_doc = {"id"=>"mods_article1",
|
13
|
-
ActiveFedora::SolrService.solr_name("
|
14
|
-
ActiveFedora::SolrService.solr_name("
|
15
|
-
ActiveFedora::SolrService.solr_name("
|
16
|
-
ActiveFedora::SolrService.solr_name("
|
17
|
-
ActiveFedora::SolrService.solr_name("
|
18
|
-
ActiveFedora::SolrService.solr_name("
|
13
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_role_roleTerm", type: :string) =>["creator","submitter","teacher"],
|
14
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_0_role", type: :string)=>"\r\ncreator\r\nsubmitter\r\n",
|
15
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_1_role", type: :string)=>"\r\n teacher \r\n",
|
16
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_0_role_0_roleTerm", type: :string)=>"creator",
|
17
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_0_role_1_roleTerm", type: :string)=>"submitter",
|
18
|
+
ActiveFedora::SolrService.solr_name("test_ds__name_1_role_0_roleTerm", type: :string)=>["teacher"]}
|
19
19
|
end
|
20
20
|
|
21
21
|
before(:each) do
|
@@ -31,7 +31,7 @@ describe ActiveFedora::OmDatastream do
|
|
31
31
|
@test_ds.stub(:new? => false)
|
32
32
|
end
|
33
33
|
|
34
|
-
its(:metadata?) { should
|
34
|
+
its(:metadata?) { should be true}
|
35
35
|
|
36
36
|
its(:controlGroup) { should == "M"}
|
37
37
|
|
@@ -58,8 +58,8 @@ describe ActiveFedora::OmDatastream do
|
|
58
58
|
|
59
59
|
describe "#prefix" do
|
60
60
|
subject { ActiveFedora::OmDatastream.new(nil, 'descMetadata') }
|
61
|
-
it "should be
|
62
|
-
subject.send(:prefix).should == ""
|
61
|
+
it "should be \"\#{dsid.underscore}__\"" do
|
62
|
+
subject.send(:prefix).should == "desc_metadata__"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -222,7 +222,7 @@ describe ActiveFedora::OmDatastream do
|
|
222
222
|
subject.stub(:new? => false )
|
223
223
|
subject.content = "<a />"
|
224
224
|
subject.ng_xml.to_xml.should =~ /<a\/>/
|
225
|
-
subject.xml_loaded.should
|
225
|
+
subject.xml_loaded.should be true
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
@@ -329,11 +329,11 @@ describe ActiveFedora::OmDatastream do
|
|
329
329
|
|
330
330
|
describe '.has_solr_name?' do
|
331
331
|
it "should return true if the given key exists in the solr document passed in" do
|
332
|
-
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("
|
333
|
-
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("
|
334
|
-
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("
|
332
|
+
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("test_ds__name_0_role_0_roleTerm", type: :string),@solr_doc).should == true
|
333
|
+
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("test_ds__name_0_role_0_roleTerm", type: :string).to_sym,@solr_doc).should == true
|
334
|
+
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("test_ds__name_1_role_1_roleTerm", type: :string),@solr_doc).should == false
|
335
335
|
#if not doc passed in should be new empty solr doc and always return false
|
336
|
-
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("
|
336
|
+
@test_ds.has_solr_name?(ActiveFedora::SolrService.solr_name("test_ds__name_0_role_0_roleTerm", type: :string)).should == false
|
337
337
|
end
|
338
338
|
end
|
339
339
|
|