active-fedora 11.0.0.rc1 → 11.0.0.rc2
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/lib/active_fedora/railtie.rb +2 -2
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/associations_spec.rb +17 -18
- data/spec/integration/attached_files_spec.rb +4 -4
- data/spec/integration/attributes_spec.rb +12 -16
- data/spec/integration/autosave_association_spec.rb +5 -5
- data/spec/integration/base_spec.rb +2 -2
- data/spec/integration/collection_association_spec.rb +2 -5
- data/spec/integration/datastream_rdf_nested_attributes_spec.rb +23 -23
- data/spec/integration/date_time_properties_spec.rb +1 -2
- data/spec/integration/direct_container_spec.rb +8 -8
- data/spec/integration/directly_contains_one_association_spec.rb +11 -13
- data/spec/integration/fedora_solr_sync_spec.rb +2 -2
- data/spec/integration/file_fixity_spec.rb +6 -8
- data/spec/integration/file_spec.rb +9 -10
- data/spec/integration/has_many_associations_spec.rb +6 -8
- data/spec/integration/indirect_container_spec.rb +8 -9
- data/spec/integration/json_serialization_spec.rb +4 -4
- data/spec/integration/ntriples_datastream_spec.rb +74 -74
- data/spec/integration/om_datastream_spec.rb +13 -13
- data/spec/integration/rdf_nested_attributes_spec.rb +6 -6
- data/spec/integration/relation_delegation_spec.rb +8 -8
- data/spec/integration/relation_spec.rb +13 -16
- data/spec/integration/solr_hit_spec.rb +4 -4
- data/spec/integration/versionable_spec.rb +132 -132
- data/spec/unit/aggregation/list_source_spec.rb +37 -37
- data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
- data/spec/unit/association_hash_spec.rb +15 -15
- data/spec/unit/attached_files_spec.rb +19 -19
- data/spec/unit/attributes_spec.rb +25 -25
- data/spec/unit/base_active_model_spec.rb +8 -8
- data/spec/unit/base_extra_spec.rb +5 -4
- data/spec/unit/base_spec.rb +9 -9
- data/spec/unit/change_set_spec.rb +5 -5
- data/spec/unit/core_spec.rb +26 -26
- data/spec/unit/default_model_mapper_spec.rb +3 -3
- data/spec/unit/fedora_spec.rb +2 -2
- data/spec/unit/file_configurator_spec.rb +92 -92
- data/spec/unit/file_spec.rb +60 -60
- data/spec/unit/files_hash_spec.rb +7 -7
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +12 -12
- data/spec/unit/has_many_association_spec.rb +2 -2
- data/spec/unit/indexers/global_indexer_spec.rb +6 -6
- data/spec/unit/indexing_service_spec.rb +5 -5
- data/spec/unit/indexing_spec.rb +4 -4
- data/spec/unit/loadable_from_json_spec.rb +4 -4
- data/spec/unit/model_classifier_spec.rb +4 -4
- data/spec/unit/nom_datastream_spec.rb +8 -8
- data/spec/unit/om_datastream_spec.rb +43 -43
- data/spec/unit/ordered_spec.rb +142 -142
- data/spec/unit/orders/list_node_spec.rb +20 -20
- data/spec/unit/orders/ordered_list_spec.rb +96 -96
- data/spec/unit/orders/reflection_spec.rb +3 -3
- data/spec/unit/pathing_spec.rb +4 -4
- data/spec/unit/persistence_spec.rb +28 -28
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +8 -8
- data/spec/unit/query_spec.rb +5 -5
- data/spec/unit/rdf/indexing_service_spec.rb +17 -17
- data/spec/unit/rdf_datastream_spec.rb +10 -10
- data/spec/unit/rdf_resource_datastream_spec.rb +37 -37
- data/spec/unit/rdfxml_datastream_spec.rb +14 -14
- data/spec/unit/readonly_spec.rb +5 -4
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
- data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
- data/spec/unit/serializers_spec.rb +3 -4
- data/spec/unit/solr_hit_spec.rb +9 -9
- data/spec/unit/sparql_insert_spec.rb +2 -2
- data/spec/unit/validations_spec.rb +9 -9
- data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +2 -1
- data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
- metadata +2 -2
@@ -18,9 +18,9 @@ describe "fedora_solr_sync_issues" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
let(:parent) { ParentThing.create }
|
21
|
-
subject { ChildThing.create parent: parent }
|
21
|
+
subject(:child) { ChildThing.create parent: parent }
|
22
22
|
|
23
|
-
before { Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection,
|
23
|
+
before { Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, child.uri).delete }
|
24
24
|
|
25
25
|
it "does not go into an infinite loop" do
|
26
26
|
parent.reload
|
@@ -15,24 +15,22 @@ describe "Checking fixity" do
|
|
15
15
|
obj = MockAFBase.create
|
16
16
|
obj.data.content = "some content"
|
17
17
|
obj.save
|
18
|
-
obj.data
|
18
|
+
obj.data.check_fixity
|
19
19
|
end
|
20
20
|
|
21
21
|
context "with a valid resource" do
|
22
|
-
it
|
23
|
-
expect(subject.check_fixity).to be true
|
24
|
-
end
|
22
|
+
it { is_expected.to be true }
|
25
23
|
end
|
26
24
|
context "when no uri has been set" do
|
27
|
-
subject { ActiveFedora::File.new }
|
25
|
+
subject(:file) { ActiveFedora::File.new }
|
28
26
|
it "raises an error" do
|
29
|
-
expect {
|
27
|
+
expect { file.check_fixity }.to raise_error(ArgumentError, "You must provide a uri")
|
30
28
|
end
|
31
29
|
end
|
32
30
|
context "with missing resource" do
|
33
|
-
subject { ActiveFedora::File.new(ActiveFedora::Base.id_to_uri('123')) }
|
31
|
+
subject(:file) { ActiveFedora::File.new(ActiveFedora::Base.id_to_uri('123')) }
|
34
32
|
it "raises an error" do
|
35
|
-
expect {
|
33
|
+
expect { file.check_fixity }.to raise_error(Ldp::NotFound)
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -4,19 +4,20 @@ require 'active_fedora'
|
|
4
4
|
require "rexml/document"
|
5
5
|
|
6
6
|
describe ActiveFedora::File do
|
7
|
+
let(:file) { described_class.new }
|
7
8
|
describe "#save" do
|
8
9
|
context "with new files" do
|
9
10
|
context "with a string" do
|
10
|
-
before {
|
11
|
+
before { file.content = "hello" }
|
11
12
|
it "saves" do
|
12
|
-
expect(
|
13
|
+
expect(file.save).to be true
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
context "with no content" do
|
17
|
-
before {
|
18
|
+
before { file.content = nil }
|
18
19
|
it "does not save" do
|
19
|
-
expect(
|
20
|
+
expect(file.save).to be false
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -43,9 +44,9 @@ describe ActiveFedora::File do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
it "saves" do
|
46
|
-
|
47
|
-
|
48
|
-
expect(
|
47
|
+
file.content = ActionDispatch::Http::UploadedFile.new
|
48
|
+
file.save
|
49
|
+
expect(file).not_to be_new_record
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -149,9 +150,7 @@ describe ActiveFedora::File do
|
|
149
150
|
end
|
150
151
|
context "open ended" do
|
151
152
|
let(:range) { 'bytes=0-' }
|
152
|
-
it
|
153
|
-
expect(subject).to eq 'one1two2threfour'
|
154
|
-
end
|
153
|
+
it { should eq 'one1two2threfour' }
|
155
154
|
end
|
156
155
|
context "not starting at the beginning" do
|
157
156
|
let(:range) { 'bytes=3-15' }
|
@@ -31,18 +31,16 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
31
31
|
let!(:book) { Book.create }
|
32
32
|
let(:library) { Library.new }
|
33
33
|
subject { library.books.count }
|
34
|
-
|
35
|
-
|
36
|
-
end
|
34
|
+
# it excludes the books that aren't associated
|
35
|
+
it { is_expected.to eq 0 }
|
37
36
|
end
|
38
37
|
|
39
38
|
context "when the owner is saved with associations" do
|
40
39
|
let(:book) { Book.create }
|
41
40
|
let!(:library) { Library.create(books: [book]) }
|
42
41
|
subject { library.reload; library.books.count }
|
43
|
-
|
44
|
-
|
45
|
-
end
|
42
|
+
# it excludes the books that are associated
|
43
|
+
it { is_expected.to eq 1 }
|
46
44
|
end
|
47
45
|
|
48
46
|
context "when the owner is not saved after checking the count" do
|
@@ -406,10 +404,10 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
406
404
|
library.save
|
407
405
|
end
|
408
406
|
|
409
|
-
subject { library.books(true) }
|
407
|
+
subject(:books) { library.books(true) }
|
410
408
|
|
411
409
|
it "saves the new title" do
|
412
|
-
expect(
|
410
|
+
expect(books.first.title).to eq ["Better book"]
|
413
411
|
end
|
414
412
|
end
|
415
413
|
end
|
@@ -130,18 +130,17 @@ describe "Indirect containers" do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
describe "#first" do
|
133
|
-
subject { reloaded.related_objects.first }
|
133
|
+
subject(:first) { reloaded.related_objects.first }
|
134
134
|
it "has the content" do
|
135
|
-
expect(
|
135
|
+
expect(first.title).to eq 'HMMM'
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
139
|
describe "#==" do
|
140
140
|
subject { reloaded.related_objects }
|
141
141
|
|
142
|
-
it
|
143
|
-
|
144
|
-
end
|
142
|
+
# it delegates to to_a
|
143
|
+
it { is_expected.to eq [file] }
|
145
144
|
end
|
146
145
|
|
147
146
|
describe "#concat" do
|
@@ -242,9 +241,9 @@ describe "Indirect containers" do
|
|
242
241
|
end
|
243
242
|
|
244
243
|
describe "#first" do
|
245
|
-
subject { reloaded.related_objects.first }
|
244
|
+
subject(:first) { reloaded.related_objects.first }
|
246
245
|
it "has the content" do
|
247
|
-
expect(
|
246
|
+
expect(first.title).to eq 'HMMM'
|
248
247
|
end
|
249
248
|
end
|
250
249
|
end
|
@@ -280,9 +279,9 @@ describe "Indirect containers" do
|
|
280
279
|
end
|
281
280
|
|
282
281
|
describe "#first" do
|
283
|
-
subject { reloaded.related_objects.first }
|
282
|
+
subject(:first) { reloaded.related_objects.first }
|
284
283
|
it "has the content" do
|
285
|
-
expect(
|
284
|
+
expect(first.title).to eq 'HMMM'
|
286
285
|
end
|
287
286
|
end
|
288
287
|
end
|
@@ -21,12 +21,12 @@ describe "Objects should be serialized to JSON" do
|
|
21
21
|
|
22
22
|
before { allow(obj).to receive(:id).and_return('test-123') }
|
23
23
|
|
24
|
-
|
24
|
+
let(:json) { JSON.parse(obj.to_json) }
|
25
25
|
|
26
26
|
it "has to_json" do
|
27
|
-
expect(
|
28
|
-
expect(
|
29
|
-
expect(
|
27
|
+
expect(json['id']).to eq "test-123"
|
28
|
+
expect(json['title']).to eq ["My Title"]
|
29
|
+
expect(json['description']).to eq "Wonderful stuff"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -30,7 +30,7 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
subject { MyDatastream.new(described_class.id_to_uri('test:1')) }
|
33
|
+
subject(:my_datastream) { MyDatastream.new(described_class.id_to_uri('test:1')) }
|
34
34
|
|
35
35
|
after do
|
36
36
|
Object.send(:remove_const, :RdfTest)
|
@@ -50,44 +50,44 @@ EOF
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "delegates as_json to the fields" do
|
53
|
-
|
54
|
-
expect(
|
55
|
-
expect(
|
53
|
+
my_datastream.title = "Title of work"
|
54
|
+
expect(my_datastream.title.as_json).to eq ["Title of work"]
|
55
|
+
expect(my_datastream.title.to_json).to eq "\[\"Title of work\"\]"
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "serializing" do
|
59
59
|
it "handles dates" do
|
60
|
-
|
61
|
-
expect(
|
60
|
+
my_datastream.date_uploaded = [Date.parse('2012-11-02')]
|
61
|
+
expect(my_datastream.date_uploaded.first).to be_kind_of Date
|
62
62
|
end
|
63
63
|
it "handles integers" do
|
64
|
-
|
65
|
-
expect(
|
66
|
-
expect(
|
64
|
+
my_datastream.filesize = 12_345
|
65
|
+
expect(my_datastream.filesize).to eq [12_345]
|
66
|
+
expect(my_datastream.filesize.first).to be_kind_of Fixnum
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
it "sets and recall values" do
|
71
|
-
|
72
|
-
expect(
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
expect(
|
78
|
-
expect(
|
79
|
-
expect(
|
80
|
-
expect(
|
71
|
+
my_datastream.title = 'War and Peace'
|
72
|
+
expect(my_datastream).to be_changed
|
73
|
+
my_datastream.based_near = ["Moscow, Russia"]
|
74
|
+
my_datastream.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
75
|
+
my_datastream.part = ["this is a part"]
|
76
|
+
my_datastream.save
|
77
|
+
expect(my_datastream.title).to eq ['War and Peace']
|
78
|
+
expect(my_datastream.based_near).to eq ["Moscow, Russia"]
|
79
|
+
expect(my_datastream.related_url).to eq ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
80
|
+
expect(my_datastream.part).to eq ["this is a part"]
|
81
81
|
end
|
82
82
|
|
83
83
|
it "set, persist, and recall values" do
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
my_datastream.title = 'War and Peace'
|
85
|
+
my_datastream.based_near = ["Moscow, Russia"]
|
86
|
+
my_datastream.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
87
|
+
my_datastream.part = ["this is a part"]
|
88
|
+
my_datastream.save
|
89
89
|
|
90
|
-
loaded = MyDatastream.new(
|
90
|
+
loaded = MyDatastream.new(my_datastream.uri)
|
91
91
|
expect(loaded.title).to eq ['War and Peace']
|
92
92
|
expect(loaded.based_near).to eq ['Moscow, Russia']
|
93
93
|
expect(loaded.related_url).to eq ['http://en.wikipedia.org/wiki/War_and_Peace']
|
@@ -95,32 +95,32 @@ EOF
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "sets multiple values" do
|
98
|
-
|
99
|
-
|
98
|
+
my_datastream.part = ["part 1", "part 2"]
|
99
|
+
my_datastream.save
|
100
100
|
|
101
|
-
loaded = MyDatastream.new(
|
101
|
+
loaded = MyDatastream.new(my_datastream.uri)
|
102
102
|
expect(loaded.part).to contain_exactly 'part 1', 'part 2'
|
103
103
|
end
|
104
104
|
|
105
105
|
it "appends values" do
|
106
|
-
|
107
|
-
|
106
|
+
my_datastream.part = ["thing 1"]
|
107
|
+
my_datastream.save
|
108
108
|
|
109
|
-
|
110
|
-
expect(
|
109
|
+
my_datastream.part << "thing 2"
|
110
|
+
expect(my_datastream.part).to contain_exactly "thing 1", "thing 2"
|
111
111
|
end
|
112
112
|
|
113
113
|
it "is able to save a blank document" do
|
114
|
-
|
115
|
-
|
114
|
+
my_datastream.title = ""
|
115
|
+
my_datastream.save
|
116
116
|
end
|
117
117
|
|
118
118
|
it "loads n-triples into the graph" do
|
119
119
|
ntrip = '<http://oregondigital.org/ns/62> <http://purl.org/dc/terms/type> "Image" .
|
120
120
|
<http://oregondigital.org/ns/62> <http://purl.org/dc/terms/spatial> "Benton County (Ore.)" .
|
121
121
|
'
|
122
|
-
|
123
|
-
expect(
|
122
|
+
my_datastream.content = ntrip
|
123
|
+
expect(my_datastream.graph.statements.to_a).to contain_exactly(*RDF::NTriples::Reader.new(ntrip).statements.to_a)
|
124
124
|
end
|
125
125
|
|
126
126
|
describe "using rdf_subject" do
|
@@ -130,55 +130,55 @@ EOF
|
|
130
130
|
rdf_subject { |ds| RDF::URI.new("http://oregondigital.org/ns/#{parent_uri(ds).split('/')[-1].split(':')[1]}") }
|
131
131
|
property :dctype, predicate: ::RDF::Vocab::DC.type
|
132
132
|
end
|
133
|
-
|
134
|
-
|
133
|
+
rdf_test.rdf.dctype = "Frog"
|
134
|
+
rdf_test.save!
|
135
135
|
end
|
136
136
|
|
137
137
|
after do
|
138
|
-
|
138
|
+
rdf_test.destroy
|
139
139
|
end
|
140
140
|
|
141
|
-
subject { RdfTest.new('/test:99') }
|
141
|
+
subject(:rdf_test) { RdfTest.new('/test:99') }
|
142
142
|
|
143
143
|
it "writes rdf with proper subjects" do
|
144
|
-
|
145
|
-
expect(
|
146
|
-
|
144
|
+
rdf_test.reload
|
145
|
+
expect(rdf_test.rdf.graph.dump(:ntriples)).to eq "<http://oregondigital.org/ns/99> <http://purl.org/dc/terms/type> \"Frog\" .\n"
|
146
|
+
rdf_test.rdf.dctype == ['Frog']
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
it "deletes values" do
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
my_datastream.title = "Hamlet"
|
152
|
+
my_datastream.related_url = ["http://psu.edu/"]
|
153
|
+
my_datastream.related_url << "http://projecthydra.org/"
|
154
154
|
|
155
|
-
expect(
|
156
|
-
expect(
|
157
|
-
expect(
|
155
|
+
expect(my_datastream.title).to eq ["Hamlet"]
|
156
|
+
expect(my_datastream.related_url).to include("http://psu.edu/")
|
157
|
+
expect(my_datastream.related_url).to include("http://projecthydra.org/")
|
158
158
|
|
159
|
-
|
160
|
-
expect(
|
159
|
+
my_datastream.title = "" # empty string can be meaningful, don't assume delete.
|
160
|
+
expect(my_datastream.title).to eq ['']
|
161
161
|
|
162
|
-
|
163
|
-
|
162
|
+
my_datastream.title = nil
|
163
|
+
my_datastream.related_url.delete("http://projecthydra.org/")
|
164
164
|
|
165
|
-
expect(
|
166
|
-
expect(
|
165
|
+
expect(my_datastream.title).to eq []
|
166
|
+
expect(my_datastream.related_url).to eq ["http://psu.edu/"]
|
167
167
|
end
|
168
168
|
|
169
169
|
it "deletes multiple values at once" do
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
expect(
|
174
|
-
|
175
|
-
expect(
|
176
|
-
expect(
|
170
|
+
my_datastream.part = ["MacBeth"]
|
171
|
+
my_datastream.part << "Hamlet"
|
172
|
+
my_datastream.part << "Romeo & Juliet"
|
173
|
+
expect(my_datastream.part).to include "MacBeth"
|
174
|
+
my_datastream.part.subtract(["MacBeth", "Romeo & Juliet"])
|
175
|
+
expect(my_datastream.part).to eq ["Hamlet"]
|
176
|
+
expect(my_datastream.part.first).to eq "Hamlet"
|
177
177
|
end
|
178
178
|
it "ignores values to be deleted that do not exist" do
|
179
|
-
|
180
|
-
|
181
|
-
expect(
|
179
|
+
my_datastream.part = ["title1", "title2", "title3"]
|
180
|
+
my_datastream.part.subtract(["title2", "title4", "title6"])
|
181
|
+
expect(my_datastream.part).to contain_exactly "title1", "title3"
|
182
182
|
end
|
183
183
|
|
184
184
|
describe "term proxy methods" do
|
@@ -187,29 +187,29 @@ EOF
|
|
187
187
|
property :title, predicate: ::RDF::Vocab::DC.title
|
188
188
|
end
|
189
189
|
end
|
190
|
-
subject { TitleDatastream.new }
|
191
|
-
before {
|
190
|
+
subject(:title_datastream) { TitleDatastream.new }
|
191
|
+
before { title_datastream.title = ["title1", "title2", "title3"] }
|
192
192
|
|
193
193
|
after(:each) do
|
194
194
|
Object.send(:remove_const, :TitleDatastream)
|
195
195
|
end
|
196
196
|
|
197
197
|
it "supports the count method to determine # of values" do
|
198
|
-
expect(
|
198
|
+
expect(title_datastream.title.count).to eq 3
|
199
199
|
end
|
200
200
|
it "iterates over multiple values" do
|
201
|
-
expect(
|
201
|
+
expect(title_datastream.title).to respond_to(:each)
|
202
202
|
end
|
203
203
|
it "evaluates equality predictably" do
|
204
|
-
expect(
|
204
|
+
expect(title_datastream.title).to contain_exactly "title1", "title2", "title3"
|
205
205
|
end
|
206
206
|
it "supports the empty? method" do
|
207
|
-
expect(
|
208
|
-
|
209
|
-
expect(
|
207
|
+
expect(title_datastream.title).to_not be_empty
|
208
|
+
title_datastream.title.subtract(["title1", "title2", "title3"])
|
209
|
+
expect(title_datastream.title).to be_empty
|
210
210
|
end
|
211
211
|
it "supports the each method" do
|
212
|
-
expect(
|
212
|
+
expect(title_datastream.title.respond_to?(:each)).to eq true
|
213
213
|
end
|
214
214
|
end
|
215
215
|
end
|
@@ -18,40 +18,40 @@ describe ActiveFedora::OmDatastream do
|
|
18
18
|
obj.destroy
|
19
19
|
end
|
20
20
|
|
21
|
-
subject { obj.descMetadata }
|
21
|
+
subject(:desc_metadata) { obj.descMetadata }
|
22
22
|
|
23
23
|
describe "#changed?" do
|
24
24
|
it "is not changed when no fields have been set" do
|
25
|
-
expect(
|
25
|
+
expect(desc_metadata).to_not be_content_changed
|
26
26
|
end
|
27
27
|
it "is changed when a field has been set" do
|
28
|
-
|
29
|
-
expect(
|
28
|
+
desc_metadata.title = 'Foobar'
|
29
|
+
expect(desc_metadata).to be_content_changed
|
30
30
|
end
|
31
31
|
it "is not changed if the new xml matches the old xml" do
|
32
|
-
|
33
|
-
expect(
|
32
|
+
desc_metadata.content = desc_metadata.content
|
33
|
+
expect(desc_metadata).to_not be_content_changed
|
34
34
|
end
|
35
35
|
|
36
36
|
it "is changed if there are minor differences in whitespace" do
|
37
|
-
|
37
|
+
desc_metadata.content = "<a><b>1</b></a>"
|
38
38
|
obj.save
|
39
|
-
expect(
|
40
|
-
|
41
|
-
expect(
|
39
|
+
expect(desc_metadata).to_not be_content_changed
|
40
|
+
desc_metadata.content = "<a>\n<b>1</b>\n</a>"
|
41
|
+
expect(desc_metadata).to be_content_changed
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "empty datastream content" do
|
46
46
|
it "does not break when there is empty datastream content" do
|
47
|
-
|
47
|
+
desc_metadata.content = ""
|
48
48
|
obj.save
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '.update_values' do
|
53
53
|
before do
|
54
|
-
|
54
|
+
desc_metadata.content = File.read(fixture('mods_articles/mods_article1.xml'))
|
55
55
|
obj.save
|
56
56
|
obj.reload
|
57
57
|
end
|
@@ -67,7 +67,7 @@ describe ActiveFedora::OmDatastream do
|
|
67
67
|
|
68
68
|
describe ".to_solr" do
|
69
69
|
before do
|
70
|
-
|
70
|
+
desc_metadata.journal.issue.publication_date = Date.parse('2012-11-02')
|
71
71
|
obj.save!
|
72
72
|
obj.reload
|
73
73
|
end
|