active-fedora 11.0.0.rc1 → 11.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_fedora/railtie.rb +2 -2
  3. data/lib/active_fedora/version.rb +1 -1
  4. data/spec/integration/associations_spec.rb +17 -18
  5. data/spec/integration/attached_files_spec.rb +4 -4
  6. data/spec/integration/attributes_spec.rb +12 -16
  7. data/spec/integration/autosave_association_spec.rb +5 -5
  8. data/spec/integration/base_spec.rb +2 -2
  9. data/spec/integration/collection_association_spec.rb +2 -5
  10. data/spec/integration/datastream_rdf_nested_attributes_spec.rb +23 -23
  11. data/spec/integration/date_time_properties_spec.rb +1 -2
  12. data/spec/integration/direct_container_spec.rb +8 -8
  13. data/spec/integration/directly_contains_one_association_spec.rb +11 -13
  14. data/spec/integration/fedora_solr_sync_spec.rb +2 -2
  15. data/spec/integration/file_fixity_spec.rb +6 -8
  16. data/spec/integration/file_spec.rb +9 -10
  17. data/spec/integration/has_many_associations_spec.rb +6 -8
  18. data/spec/integration/indirect_container_spec.rb +8 -9
  19. data/spec/integration/json_serialization_spec.rb +4 -4
  20. data/spec/integration/ntriples_datastream_spec.rb +74 -74
  21. data/spec/integration/om_datastream_spec.rb +13 -13
  22. data/spec/integration/rdf_nested_attributes_spec.rb +6 -6
  23. data/spec/integration/relation_delegation_spec.rb +8 -8
  24. data/spec/integration/relation_spec.rb +13 -16
  25. data/spec/integration/solr_hit_spec.rb +4 -4
  26. data/spec/integration/versionable_spec.rb +132 -132
  27. data/spec/unit/aggregation/list_source_spec.rb +37 -37
  28. data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
  29. data/spec/unit/association_hash_spec.rb +15 -15
  30. data/spec/unit/attached_files_spec.rb +19 -19
  31. data/spec/unit/attributes_spec.rb +25 -25
  32. data/spec/unit/base_active_model_spec.rb +8 -8
  33. data/spec/unit/base_extra_spec.rb +5 -4
  34. data/spec/unit/base_spec.rb +9 -9
  35. data/spec/unit/change_set_spec.rb +5 -5
  36. data/spec/unit/core_spec.rb +26 -26
  37. data/spec/unit/default_model_mapper_spec.rb +3 -3
  38. data/spec/unit/fedora_spec.rb +2 -2
  39. data/spec/unit/file_configurator_spec.rb +92 -92
  40. data/spec/unit/file_spec.rb +60 -60
  41. data/spec/unit/files_hash_spec.rb +7 -7
  42. data/spec/unit/has_and_belongs_to_many_association_spec.rb +12 -12
  43. data/spec/unit/has_many_association_spec.rb +2 -2
  44. data/spec/unit/indexers/global_indexer_spec.rb +6 -6
  45. data/spec/unit/indexing_service_spec.rb +5 -5
  46. data/spec/unit/indexing_spec.rb +4 -4
  47. data/spec/unit/loadable_from_json_spec.rb +4 -4
  48. data/spec/unit/model_classifier_spec.rb +4 -4
  49. data/spec/unit/nom_datastream_spec.rb +8 -8
  50. data/spec/unit/om_datastream_spec.rb +43 -43
  51. data/spec/unit/ordered_spec.rb +142 -142
  52. data/spec/unit/orders/list_node_spec.rb +20 -20
  53. data/spec/unit/orders/ordered_list_spec.rb +96 -96
  54. data/spec/unit/orders/reflection_spec.rb +3 -3
  55. data/spec/unit/pathing_spec.rb +4 -4
  56. data/spec/unit/persistence_spec.rb +28 -28
  57. data/spec/unit/qualified_dublin_core_datastream_spec.rb +8 -8
  58. data/spec/unit/query_spec.rb +5 -5
  59. data/spec/unit/rdf/indexing_service_spec.rb +17 -17
  60. data/spec/unit/rdf_datastream_spec.rb +10 -10
  61. data/spec/unit/rdf_resource_datastream_spec.rb +37 -37
  62. data/spec/unit/rdfxml_datastream_spec.rb +14 -14
  63. data/spec/unit/readonly_spec.rb +5 -4
  64. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
  65. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
  66. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
  67. data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
  68. data/spec/unit/serializers_spec.rb +3 -4
  69. data/spec/unit/solr_hit_spec.rb +9 -9
  70. data/spec/unit/sparql_insert_spec.rb +2 -2
  71. data/spec/unit/validations_spec.rb +9 -9
  72. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +2 -1
  73. data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
  74. metadata +2 -2
@@ -2,12 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::RDFXMLDatastream do
4
4
  describe "a new instance" do
5
+ subject(:my_datastream) { MyRdfxmlDatastream.new }
5
6
  before(:each) do
6
7
  class MyRdfxmlDatastream < ActiveFedora::RDFXMLDatastream
7
8
  property :publisher, predicate: ::RDF::Vocab::DC.publisher
8
9
  end
9
- @subject = MyRdfxmlDatastream.new
10
- allow(@subject).to receive(:id).and_return('test:1')
10
+ allow(my_datastream).to receive(:id).and_return('test:1')
11
11
  end
12
12
 
13
13
  after(:each) do
@@ -15,8 +15,8 @@ describe ActiveFedora::RDFXMLDatastream do
15
15
  end
16
16
 
17
17
  it "saves and reload" do
18
- @subject.publisher = ["St. Martin's Press"]
19
- expect(@subject.serialize).to match(/<rdf:RDF/)
18
+ my_datastream.publisher = ["St. Martin's Press"]
19
+ expect(my_datastream.serialize).to match(/<rdf:RDF/)
20
20
  end
21
21
  end
22
22
 
@@ -79,27 +79,27 @@ describe ActiveFedora::RDFXMLDatastream do
79
79
  end
80
80
 
81
81
  describe "a new instance" do
82
- subject { MyDatastream.new(about: "http://library.ucsd.edu/ark:/20775/") }
82
+ let(:my_datastream) { MyDatastream.new(about: "http://library.ucsd.edu/ark:/20775/") }
83
83
  it "has a subject" do
84
- expect(subject.rdf_subject.to_s).to eq "http://library.ucsd.edu/ark:/20775/"
84
+ expect(my_datastream.rdf_subject.to_s).to eq "http://library.ucsd.edu/ark:/20775/"
85
85
  end
86
86
  end
87
87
 
88
88
  describe "an instance with content" do
89
- subject do
90
- subject = MyDatastream.new(about: "http://library.ucsd.edu/ark:/20775/")
91
- subject.content = File.new('spec/fixtures/damsObjectModel.xml').read
92
- subject
89
+ let(:my_datastream) do
90
+ my_datastream = MyDatastream.new(about: "http://library.ucsd.edu/ark:/20775/")
91
+ my_datastream.content = File.new('spec/fixtures/damsObjectModel.xml').read
92
+ my_datastream
93
93
  end
94
94
  it "has a subject" do
95
- expect(subject.rdf_subject.to_s).to eq "http://library.ucsd.edu/ark:/20775/"
95
+ expect(my_datastream.rdf_subject.to_s).to eq "http://library.ucsd.edu/ark:/20775/"
96
96
  end
97
97
  it "has mimeType" do
98
- expect(subject.mime_type).to eq 'text/xml'
98
+ expect(my_datastream.mime_type).to eq 'text/xml'
99
99
  end
100
100
  it "has fields" do
101
- expect(subject.resource_type).to eq ["image"]
102
- expect(subject.title.first.value).to eq ["example title"]
101
+ expect(my_datastream.resource_type).to eq ["image"]
102
+ expect(my_datastream.title.first.value).to eq ["example title"]
103
103
  end
104
104
  end
105
105
  end
@@ -1,23 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
+ subject(:object) { described_class.new }
4
5
  it { is_expected.not_to be_readonly }
5
6
 
6
7
  describe "#readonly!" do
7
8
  it "makes the object readonly" do
8
- expect { subject.readonly! }.to change { subject.readonly? }.from(false).to(true)
9
+ expect { object.readonly! }.to change { object.readonly? }.from(false).to(true)
9
10
  end
10
11
  end
11
12
 
12
13
  context "a readonly record" do
13
- before { subject.readonly! }
14
+ before { object.readonly! }
14
15
 
15
16
  it "does not be destroyable" do
16
- expect { subject.destroy }.to raise_error ActiveFedora::ReadOnlyRecord
17
+ expect { object.destroy }.to raise_error ActiveFedora::ReadOnlyRecord
17
18
  end
18
19
 
19
20
  it "does not be mutable" do
20
- expect { subject.save }.to raise_error ActiveFedora::ReadOnlyRecord
21
+ expect { object.save }.to raise_error ActiveFedora::ReadOnlyRecord
21
22
  end
22
23
  end
23
24
  end
@@ -3,30 +3,30 @@ require 'ostruct'
3
3
  require "active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher"
4
4
 
5
5
  describe RSpec::Matchers, ".belong_to_associated_active_fedora_object" do
6
- subject { OpenStruct.new(id: id) }
6
+ let(:open_struct) { OpenStruct.new(id: id) }
7
7
  let(:id) { 123 }
8
8
  let(:object1) { Object.new }
9
9
  let(:object2) { Object.new }
10
10
  let(:association) { :association }
11
11
 
12
12
  it 'matches when association is properly stored in fedora' do
13
- expect(subject.class).to receive(:find).with(id).and_return(subject)
14
- expect(subject).to receive(association).and_return(object1)
15
- expect(subject).to belong_to_associated_active_fedora_object(association).with_object(object1)
13
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
14
+ expect(open_struct).to receive(association).and_return(object1)
15
+ expect(open_struct).to belong_to_associated_active_fedora_object(association).with_object(object1)
16
16
  end
17
17
 
18
18
  it 'does not match when association is different' do
19
- expect(subject.class).to receive(:find).with(id).and_return(subject)
20
- expect(subject).to receive(association).and_return(object1)
19
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
20
+ expect(open_struct).to receive(association).and_return(object1)
21
21
  expect {
22
- expect(subject).to belong_to_associated_active_fedora_object(association).with_object(object2)
22
+ expect(open_struct).to belong_to_associated_active_fedora_object(association).with_object(object2)
23
23
  }.to raise_error RSpec::Expectations::ExpectationNotMetError,
24
- /expected #{subject.class} ID=#{id} association: #{association.inspect}/
24
+ /expected #{open_struct.class} ID=#{id} association: #{association.inspect}/
25
25
  end
26
26
 
27
27
  it 'requires :with_object option' do
28
28
  expect {
29
- expect(subject).to belong_to_associated_active_fedora_object(association)
29
+ expect(open_struct).to belong_to_associated_active_fedora_object(association)
30
30
  }.to(
31
31
  raise_error(
32
32
  ArgumentError,
@@ -3,7 +3,7 @@ require 'ostruct'
3
3
  require "active_fedora/rspec_matchers/have_many_associated_active_fedora_objects_matcher"
4
4
 
5
5
  describe RSpec::Matchers, ".have_many_associated_active_fedora_objects" do
6
- subject { OpenStruct.new(id: id) }
6
+ let(:open_struct) { OpenStruct.new(id: id) }
7
7
  let(:id) { 123 }
8
8
  let(:object1) { Object.new }
9
9
  let(:object2) { Object.new }
@@ -11,23 +11,23 @@ describe RSpec::Matchers, ".have_many_associated_active_fedora_objects" do
11
11
  let(:association) { :association }
12
12
 
13
13
  it 'matches when association is properly stored in fedora' do
14
- expect(subject.class).to receive(:find).with(id).and_return(subject)
15
- expect(subject).to receive(association).and_return([object1, object2])
16
- expect(subject).to have_many_associated_active_fedora_objects(association).with_objects([object1, object2])
14
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
15
+ expect(open_struct).to receive(association).and_return([object1, object2])
16
+ expect(open_struct).to have_many_associated_active_fedora_objects(association).with_objects([object1, object2])
17
17
  end
18
18
 
19
19
  it 'does not match when association is different' do
20
- expect(subject.class).to receive(:find).with(id).and_return(subject)
21
- expect(subject).to receive(association).and_return([object1, object3])
20
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
21
+ expect(open_struct).to receive(association).and_return([object1, object3])
22
22
  expect {
23
- expect(subject).to have_many_associated_active_fedora_objects(association).with_objects([object1, object2])
23
+ expect(open_struct).to have_many_associated_active_fedora_objects(association).with_objects([object1, object2])
24
24
  }.to raise_error RSpec::Expectations::ExpectationNotMetError,
25
- /expected #{subject.class} ID=#{id} association: #{association.inspect}/
25
+ /expected #{open_struct.class} ID=#{id} association: #{association.inspect}/
26
26
  end
27
27
 
28
28
  it 'requires :with_objects option' do
29
29
  expect {
30
- expect(subject).to have_many_associated_active_fedora_objects(association)
30
+ expect(open_struct).to have_many_associated_active_fedora_objects(association)
31
31
  }.to(
32
32
  raise_error(
33
33
  ArgumentError,
@@ -3,7 +3,7 @@ require 'ostruct'
3
3
  require "active_fedora/rspec_matchers/have_predicate_matcher"
4
4
 
5
5
  describe RSpec::Matchers, ".have_predicate" do
6
- subject { OpenStruct.new(id: id) }
6
+ let(:open_struct) { OpenStruct.new(id: id) }
7
7
  let(:id) { 123 }
8
8
  let(:object1) { Object.new }
9
9
  let(:object2) { Object.new }
@@ -11,23 +11,23 @@ describe RSpec::Matchers, ".have_predicate" do
11
11
  let(:predicate) { :predicate }
12
12
 
13
13
  it 'matches when relationship is "what we have in Fedora"' do
14
- expect(subject.class).to receive(:find).with(id).and_return(subject)
15
- expect(subject).to receive(:relationships).with(predicate).and_return([object1, object2])
16
- expect(subject).to have_predicate(predicate).with_objects([object1, object2])
14
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
15
+ expect(open_struct).to receive(:relationships).with(predicate).and_return([object1, object2])
16
+ expect(open_struct).to have_predicate(predicate).with_objects([object1, object2])
17
17
  end
18
18
 
19
19
  it 'does not match when relationship is different' do
20
- expect(subject.class).to receive(:find).with(id).and_return(subject)
21
- expect(subject).to receive(:relationships).with(predicate).and_return([object1, object3])
20
+ expect(open_struct.class).to receive(:find).with(id).and_return(open_struct)
21
+ expect(open_struct).to receive(:relationships).with(predicate).and_return([object1, object3])
22
22
  expect {
23
- expect(subject).to have_predicate(predicate).with_objects([object1, object2])
23
+ expect(open_struct).to have_predicate(predicate).with_objects([object1, object2])
24
24
  }.to raise_error RSpec::Expectations::ExpectationNotMetError,
25
- /expected #{subject.class} ID=#{id} relationship: #{predicate.inspect}/
25
+ /expected #{open_struct.class} ID=#{id} relationship: #{predicate.inspect}/
26
26
  end
27
27
 
28
28
  it 'requires :with_objects option' do
29
29
  expect {
30
- expect(subject).to have_predicate(predicate)
30
+ expect(open_struct).to have_predicate(predicate)
31
31
  }.to(
32
32
  raise_error(
33
33
  ArgumentError,
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe ActiveFedora::SchemaIndexingStrategy do
4
- subject { described_class.new(property_indexer_factory) }
4
+ subject(:index_strategy) { described_class.new(property_indexer_factory) }
5
5
 
6
6
  describe "#apply" do
7
7
  let(:property) do
@@ -40,9 +40,9 @@ RSpec.describe ActiveFedora::SchemaIndexingStrategy do
40
40
  end
41
41
  let(:index_types) {}
42
42
  context "with no index types" do
43
- subject { described_class.new }
43
+ subject(:index_strategy) { described_class.new }
44
44
  it "does not try to index it" do
45
- subject.apply(object, property)
45
+ index_strategy.apply(object, property)
46
46
 
47
47
  expect(object).to have_received(:property).with(property.name, property.to_h)
48
48
  expect(index_configuration).not_to have_received(:as)
@@ -51,7 +51,7 @@ RSpec.describe ActiveFedora::SchemaIndexingStrategy do
51
51
  context "with one index type" do
52
52
  let(:index_types) { :symbol }
53
53
  it "applies that one" do
54
- subject.apply(object, property)
54
+ index_strategy.apply(object, property)
55
55
 
56
56
  expect(index_configuration).to have_received(:as).with(:symbol)
57
57
  end
@@ -59,7 +59,7 @@ RSpec.describe ActiveFedora::SchemaIndexingStrategy do
59
59
  context "with multiple index types" do
60
60
  let(:index_types) { [:symbol, :stored_searchable] }
61
61
  it "applies all of them" do
62
- subject.apply(object, property)
62
+ index_strategy.apply(object, property)
63
63
 
64
64
  expect(index_configuration).to have_received(:as).with(:symbol, :stored_searchable)
65
65
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Attributes::Serializers do
4
- subject { ActiveFedora::Base }
5
4
  describe "deserialize_dates_from_form" do
6
5
  before do
7
6
  class Foo < ActiveFedora::Base
@@ -11,10 +10,10 @@ describe ActiveFedora::Attributes::Serializers do
11
10
  after do
12
11
  Object.send(:remove_const, :Foo)
13
12
  end
14
- subject { Foo.new }
13
+ subject(:serializer) { Foo.new }
15
14
  it "deserializes dates" do
16
- subject.attributes = { 'birthday(1i)' => '2012', 'birthday(2i)' => '10', 'birthday(3i)' => '31' }
17
- expect(subject.birthday).to eq '2012-10-31'
15
+ serializer.attributes = { 'birthday(1i)' => '2012', 'birthday(2i)' => '10', 'birthday(3i)' => '31' }
16
+ expect(serializer.birthday).to eq '2012-10-31'
18
17
  end
19
18
  end
20
19
  end
@@ -9,50 +9,50 @@ describe ActiveFedora::SolrHit do
9
9
  end
10
10
  end
11
11
 
12
- subject { described_class.new "id" => "my:_ID1_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] }
12
+ subject(:solr_hit) { described_class.new "id" => "my:_ID1_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] }
13
13
 
14
14
  describe "#reify" do
15
15
  it "uses .find to instantiate objects" do
16
16
  expect(AudioRecord).to receive(:find).with("my:_ID1_", cast: true)
17
- subject.reify
17
+ solr_hit.reify
18
18
  end
19
19
  end
20
20
 
21
21
  describe "#id" do
22
22
  it "extracts the id from the solr hit" do
23
- expect(subject.id).to eq "my:_ID1_"
23
+ expect(solr_hit.id).to eq "my:_ID1_"
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#rdf_uri" do
28
28
  it "provides an RDF URI for the solr hit" do
29
- expect(subject.rdf_uri).to eq ::RDF::URI.new(ActiveFedora::Base.id_to_uri("my:_ID1_"))
29
+ expect(solr_hit.rdf_uri).to eq ::RDF::URI.new(ActiveFedora::Base.id_to_uri("my:_ID1_"))
30
30
  end
31
31
  end
32
32
 
33
33
  describe "#model" do
34
34
  it "selects the appropriate model for the solr result" do
35
- expect(subject.model).to eq AudioRecord
35
+ expect(solr_hit.model).to eq AudioRecord
36
36
  end
37
37
  end
38
38
 
39
39
  describe "#models" do
40
40
  it "provides all the relevant models for the solr result" do
41
- expect(subject.models).to match_array [AudioRecord]
41
+ expect(solr_hit.models).to match_array [AudioRecord]
42
42
  end
43
43
  end
44
44
 
45
45
  describe "#model?" do
46
46
  it 'is true if the object has the given model' do
47
- expect(subject.model?(AudioRecord)).to eq true
47
+ expect(solr_hit.model?(AudioRecord)).to eq true
48
48
  end
49
49
 
50
50
  it 'is true if the object has an ancestor of the given model' do
51
- expect(subject.model?(ActiveFedora::Base)).to eq true
51
+ expect(solr_hit.model?(ActiveFedora::Base)).to eq true
52
52
  end
53
53
 
54
54
  it 'is false if the given model is not in the ancestor tree for the models' do
55
- expect(subject.model?(String)).to eq false
55
+ expect(solr_hit.model?(String)).to eq false
56
56
  end
57
57
  end
58
58
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::SparqlInsert do
4
4
  let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) }
5
- subject { described_class.new(change_set.changes) }
5
+ subject(:sparql_insert) { described_class.new(change_set.changes) }
6
6
 
7
7
  context "with a changed object" do
8
8
  before do
@@ -25,7 +25,7 @@ describe ActiveFedora::SparqlInsert do
25
25
  let(:base) { Book.create }
26
26
 
27
27
  it "returns the string" do
28
- expect(subject.build).to eq "DELETE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . }\n WHERE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . } ;\nDELETE { <> <http://purl.org/dc/terms/title> ?change . }\n WHERE { <> <http://purl.org/dc/terms/title> ?change . } ;\nINSERT { \n<> <info:fedora/fedora-system:def/relations-external#hasConstituent> <#{ActiveFedora.fedora.host}/test/foo> .\n<> <http://purl.org/dc/terms/title> \"bar\" .\n}\n WHERE { }"
28
+ expect(sparql_insert.build).to eq "DELETE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . }\n WHERE { <> <info:fedora/fedora-system:def/relations-external#hasConstituent> ?change . } ;\nDELETE { <> <http://purl.org/dc/terms/title> ?change . }\n WHERE { <> <http://purl.org/dc/terms/title> ?change . } ;\nINSERT { \n<> <info:fedora/fedora-system:def/relations-external#hasConstituent> <#{ActiveFedora.fedora.host}/test/foo> .\n<> <http://purl.org/dc/terms/title> \"bar\" .\n}\n WHERE { }"
29
29
  end
30
30
  end
31
31
  end
@@ -11,7 +11,7 @@ describe ActiveFedora::Base do
11
11
  end
12
12
  end
13
13
 
14
- subject { ValidationStub.new }
14
+ subject(:validation_stub) { ValidationStub.new }
15
15
 
16
16
  after :all do
17
17
  Object.send(:remove_const, :ValidationStub)
@@ -19,19 +19,19 @@ describe ActiveFedora::Base do
19
19
 
20
20
  describe "a valid object" do
21
21
  before do
22
- subject.attributes = { fubar: ['here'], swank: 'long enough' }
22
+ validation_stub.attributes = { fubar: ['here'], swank: 'long enough' }
23
23
  end
24
24
 
25
25
  it { should be_valid }
26
26
  end
27
27
  describe "an invalid object" do
28
28
  before do
29
- subject.attributes = { swank: 'smal' }
29
+ validation_stub.attributes = { swank: 'smal' }
30
30
  end
31
31
  it "has errors" do
32
- expect(subject).to_not be_valid
33
- expect(subject.errors[:fubar]).to eq ["can't be blank"]
34
- expect(subject.errors[:swank]).to eq ["is too short (minimum is 5 characters)"]
32
+ expect(validation_stub).to_not be_valid
33
+ expect(validation_stub.errors[:fubar]).to eq ["can't be blank"]
34
+ expect(validation_stub.errors[:swank]).to eq ["is too short (minimum is 5 characters)"]
35
35
  end
36
36
  end
37
37
 
@@ -41,11 +41,11 @@ describe ActiveFedora::Base do
41
41
  end
42
42
 
43
43
  describe "#save!" do
44
- before { allow(subject).to receive(:_create_record) } # prevent saving to Fedora/Solr
44
+ before { allow(validation_stub).to receive(:_create_record) } # prevent saving to Fedora/Solr
45
45
 
46
46
  it "validates only once" do
47
- expect(subject).to receive(:perform_validations).once.and_return(true)
48
- subject.save!
47
+ expect(validation_stub).to receive(:perform_validations).once.and_return(true)
48
+ validation_stub.save!
49
49
  end
50
50
  end
51
51
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::WithMetadata::DefaultMetadataClassFactory do
4
4
  let(:parent) { double("Parent") }
5
+ let(:object) { described_class.new }
5
6
 
6
7
  describe "default class attributes" do
7
8
  its(:metadata_base_class) { is_expected.to eq(ActiveFedora::WithMetadata::MetadataNode) }
@@ -22,7 +23,7 @@ describe ActiveFedora::WithMetadata::DefaultMetadataClassFactory do
22
23
  to: :metadata_node)
23
24
  expect(parent).to receive(:delegate).with(:byte_order, :byte_order=, :byte_order_changed?, to: :metadata_node)
24
25
  expect(parent).to receive(:delegate).with(:file_hash, :file_hash=, :file_hash_changed?, to: :metadata_node)
25
- subject.class.build(parent)
26
+ object.class.build(parent)
26
27
  end
27
28
  end
28
29
  end
@@ -24,7 +24,8 @@ describe ActiveFedora::WithMetadata::MetadataNode do
24
24
  end
25
25
 
26
26
  describe "changes_for_update" do
27
- subject { node.send(:changes_for_update) }
27
+ let(:changes_for_update) { node.send(:changes_for_update) }
28
+ subject { changes_for_update }
28
29
 
29
30
  context "when type is not set" do
30
31
  it { is_expected.to eq({}) }
@@ -36,7 +37,7 @@ describe ActiveFedora::WithMetadata::MetadataNode do
36
37
  end
37
38
 
38
39
  it "is expected to have the rdf type statement" do
39
- expect(subject[::RDF.type]).to be_kind_of RDF::Queryable::Enumerator
40
+ expect(changes_for_update[::RDF.type]).to be_kind_of RDF::Queryable::Enumerator
40
41
  end
41
42
  end
42
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0.rc1
4
+ version: 11.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-29 00:00:00.000000000 Z
13
+ date: 2016-08-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr