active-fedora 6.7.8 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +938 -0
  5. data/.travis.yml +5 -6
  6. data/Gemfile +3 -1
  7. data/Rakefile +7 -5
  8. data/active-fedora.gemspec +7 -8
  9. data/lib/active_fedora/om_datastream.rb +1 -0
  10. data/lib/active_fedora/rdf_xml_writer.rb +31 -62
  11. data/lib/active_fedora/version.rb +1 -1
  12. data/spec/config_helper.rb +14 -14
  13. data/spec/integration/associations_spec.rb +232 -232
  14. data/spec/integration/attributes_spec.rb +11 -12
  15. data/spec/integration/auditable_spec.rb +10 -10
  16. data/spec/integration/base_spec.rb +163 -163
  17. data/spec/integration/bug_spec.rb +7 -7
  18. data/spec/integration/complex_rdf_datastream_spec.rb +88 -88
  19. data/spec/integration/datastream_collections_spec.rb +69 -69
  20. data/spec/integration/datastream_spec.rb +43 -43
  21. data/spec/integration/datastreams_spec.rb +63 -63
  22. data/spec/integration/delegating_spec.rb +14 -14
  23. data/spec/integration/delete_all_spec.rb +38 -42
  24. data/spec/integration/fedora_solr_sync_spec.rb +5 -5
  25. data/spec/integration/full_featured_model_spec.rb +101 -101
  26. data/spec/integration/has_many_associations_spec.rb +24 -24
  27. data/spec/integration/model_spec.rb +30 -30
  28. data/spec/integration/nested_attribute_spec.rb +41 -41
  29. data/spec/integration/ntriples_datastream_spec.rb +107 -107
  30. data/spec/integration/om_datastream_spec.rb +67 -67
  31. data/spec/integration/persistence_spec.rb +6 -6
  32. data/spec/integration/rdf_nested_attributes_spec.rb +56 -56
  33. data/spec/integration/relation_delegation_spec.rb +24 -26
  34. data/spec/integration/rels_ext_datastream_spec.rb +20 -20
  35. data/spec/integration/scoped_query_spec.rb +40 -41
  36. data/spec/integration/solr_instance_loader_spec.rb +4 -4
  37. data/spec/integration/solr_service_spec.rb +46 -46
  38. data/spec/rails3_test_app/config/application.rb +1 -1
  39. data/spec/rails3_test_app/config/environments/development.rb +0 -1
  40. data/spec/rails3_test_app/config/environments/production.rb +1 -1
  41. data/spec/rails3_test_app/spec/spec_helper.rb +3 -3
  42. data/spec/rails3_test_app/spec/unit/rails_3_init.rb +4 -4
  43. data/spec/samples/hydra-mods_article_datastream.rb +334 -334
  44. data/spec/samples/hydra-rights_metadata_datastream.rb +57 -57
  45. data/spec/samples/marpa-dc_datastream.rb +17 -17
  46. data/spec/samples/models/audio_record.rb +16 -16
  47. data/spec/samples/models/image.rb +2 -2
  48. data/spec/samples/models/mods_article.rb +5 -5
  49. data/spec/samples/models/oral_history.rb +18 -18
  50. data/spec/samples/models/seminar.rb +24 -24
  51. data/spec/samples/models/seminar_audio_file.rb +17 -17
  52. data/spec/samples/oral_history_sample_model.rb +21 -21
  53. data/spec/samples/special_thing.rb +14 -14
  54. data/spec/spec_helper.rb +7 -11
  55. data/spec/support/an_active_model.rb +2 -2
  56. data/spec/support/mock_fedora.rb +16 -17
  57. data/spec/unit/active_fedora_spec.rb +58 -58
  58. data/spec/unit/association_proxy_spec.rb +5 -7
  59. data/spec/unit/base_active_model_spec.rb +25 -26
  60. data/spec/unit/base_cma_spec.rb +5 -5
  61. data/spec/unit/base_datastream_management_spec.rb +27 -27
  62. data/spec/unit/base_delegate_spec.rb +80 -82
  63. data/spec/unit/base_delegate_to_spec.rb +37 -39
  64. data/spec/unit/base_extra_spec.rb +48 -48
  65. data/spec/unit/base_spec.rb +300 -300
  66. data/spec/unit/callback_spec.rb +19 -19
  67. data/spec/unit/code_configurator_spec.rb +17 -17
  68. data/spec/unit/config_spec.rb +16 -8
  69. data/spec/unit/content_model_spec.rb +60 -60
  70. data/spec/unit/datastream_collections_spec.rb +229 -229
  71. data/spec/unit/datastream_spec.rb +57 -54
  72. data/spec/unit/datastreams_spec.rb +77 -77
  73. data/spec/unit/file_configurator_spec.rb +217 -217
  74. data/spec/unit/has_and_belongs_to_many_collection_spec.rb +26 -26
  75. data/spec/unit/has_many_collection_spec.rb +9 -9
  76. data/spec/unit/inheritance_spec.rb +12 -13
  77. data/spec/unit/model_spec.rb +41 -51
  78. data/spec/unit/nom_datastream_spec.rb +15 -15
  79. data/spec/unit/ntriples_datastream_spec.rb +112 -112
  80. data/spec/unit/om_datastream_spec.rb +233 -227
  81. data/spec/unit/persistence_spec.rb +6 -6
  82. data/spec/unit/predicates_spec.rb +73 -73
  83. data/spec/unit/property_spec.rb +9 -17
  84. data/spec/unit/qualified_dublin_core_datastream_spec.rb +33 -33
  85. data/spec/unit/query_spec.rb +188 -217
  86. data/spec/unit/rdf_datastream_spec.rb +28 -21
  87. data/spec/unit/rdf_list_nested_attributes_spec.rb +34 -34
  88. data/spec/unit/rdf_list_spec.rb +80 -104
  89. data/spec/unit/rdf_node_spec.rb +7 -7
  90. data/spec/unit/rdf_xml_writer_spec.rb +10 -10
  91. data/spec/unit/rdfxml_rdf_datastream_spec.rb +27 -27
  92. data/spec/unit/relationship_graph_spec.rb +51 -51
  93. data/spec/unit/rels_ext_datastream_spec.rb +75 -69
  94. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +15 -15
  95. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +15 -15
  96. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +15 -15
  97. data/spec/unit/rspec_matchers/match_fedora_datastream_matcher_spec.rb +12 -12
  98. data/spec/unit/rubydora_connection_spec.rb +5 -5
  99. data/spec/unit/semantic_node_spec.rb +59 -59
  100. data/spec/unit/serializers_spec.rb +4 -4
  101. data/spec/unit/service_definitions_spec.rb +26 -26
  102. data/spec/unit/simple_datastream_spec.rb +17 -17
  103. data/spec/unit/solr_config_options_spec.rb +27 -28
  104. data/spec/unit/solr_digital_object_spec.rb +21 -21
  105. data/spec/unit/solr_service_spec.rb +81 -81
  106. data/spec/unit/unsaved_digital_object_spec.rb +20 -20
  107. data/spec/unit/validations_spec.rb +21 -21
  108. metadata +70 -58
  109. data/gemfiles/gemfile.rails3 +0 -11
  110. data/gemfiles/gemfile.rails4 +0 -10
@@ -1,14 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Associations::AssociationProxy do
4
- it "should delegate to_param" do
5
- pending
6
- @owner = stub(:new_record? => false)
4
+ it 'should delegate to_param' do
5
+ skip
6
+ @owner = double(:new_record? => false)
7
7
  @assoc = ActiveFedora::Associations::AssociationProxy.new(@owner, @reflection)
8
- @assoc.should_receive(:find_target).and_return(stub(:to_param => '1234'))
8
+ expect(@assoc).to receive(:find_target).and_return(double(:to_param => '1234'))
9
9
  @assoc.send(:load_target)
10
- @assoc.to_param.should == '1234'
11
-
10
+ expect(@assoc.to_param).to eq('1234')
12
11
  end
13
-
14
12
  end
@@ -1,54 +1,54 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
- describe "active model methods" do
5
- class BarStream < ActiveFedora::OmDatastream
4
+ describe 'active model methods' do
5
+ class BarStream < ActiveFedora::OmDatastream
6
6
  set_terminology do |t|
7
- t.root(:path=>"first", :xmlns=>"urn:foobar")
7
+ t.root(:path => 'first', :xmlns => 'urn:foobar')
8
8
  t.duck()
9
9
  end
10
10
 
11
11
  def self.xml_template
12
- Nokogiri::XML::Document.parse '<first xmlns="urn:foobar">
12
+ Nokogiri::XML::Document.parse '<first xmlns="urn:foobar">
13
13
  <duck></duck>
14
14
  </first>'
15
15
  end
16
16
  end
17
17
 
18
18
  class BarHistory < ActiveFedora::Base
19
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
20
- m.field "fubar", :string
21
- m.field "swank", :text
19
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'someData' do |m|
20
+ m.field 'fubar', :string
21
+ m.field 'swank', :text
22
22
  end
23
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"withText" do |m|
24
- m.field "fubar", :text
23
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'withText' do |m|
24
+ m.field 'fubar', :text
25
+ end
26
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'withText2', :label => 'withLabel' do |m|
27
+ m.field 'fubar', :text
25
28
  end
26
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"withText2", :label=>"withLabel" do |m|
27
- m.field "fubar", :text
28
- end
29
29
 
30
- has_metadata :type=>BarStream, :name=>"xmlish"
30
+ has_metadata :type => BarStream, :name => 'xmlish'
31
31
  delegate :fubar, to: 'withText', multiple: false
32
32
  delegate :duck, to: 'xmlish', multiple: false
33
33
  end
34
34
  before :each do
35
35
  @n = BarHistory.new()
36
36
  end
37
- describe "attributes=" do
38
- it "should set attributes" do
39
- @n.attributes = {:fubar=>"baz", :duck=>"Quack"}
40
- @n.fubar.should == "baz"
41
- @n.withText.get_values(:fubar).first.should == 'baz'
42
- @n.duck.should == "Quack"
43
- @n.xmlish.term_values(:duck).first.should == 'Quack'
37
+ describe 'attributes=' do
38
+ it 'should set attributes' do
39
+ @n.attributes = {:fubar => 'baz', :duck => 'Quack'}
40
+ expect(@n.fubar).to eq('baz')
41
+ expect(@n.withText.get_values(:fubar).first).to eq('baz')
42
+ expect(@n.duck).to eq('Quack')
43
+ expect(@n.xmlish.term_values(:duck).first).to eq('Quack')
44
44
  end
45
45
  end
46
- describe "update_attributes" do
47
- it "should set attributes and save " do
48
- @n.update_attributes(:fubar=>"baz", :duck=>"Quack")
46
+ describe 'update_attributes' do
47
+ it 'should set attributes and save ' do
48
+ @n.update_attributes(:fubar => 'baz', :duck => 'Quack')
49
49
  @q = BarHistory.find(@n.pid)
50
- @q.fubar.should == "baz"
51
- @q.duck.should == "Quack"
50
+ expect(@q.fubar).to eq('baz')
51
+ expect(@q.duck).to eq('Quack')
52
52
  end
53
53
  after do
54
54
  @n.delete
@@ -57,4 +57,3 @@ describe ActiveFedora::Base do
57
57
 
58
58
  end
59
59
  end
60
-
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
-
4
+
5
5
  before(:each) do
6
6
  @test_object = ActiveFedora::Base.new
7
7
  end
8
-
8
+
9
9
  describe '.save' do
10
10
 
11
- it "should add hasModel relationship that points to the CModel if @new_object" do
12
- @test_object.stub(:update_index)
13
- @test_object.should_receive(:refresh)
11
+ it 'should add hasModel relationship that points to the CModel if @new_object' do
12
+ allow(@test_object).to receive(:update_index)
13
+ expect(@test_object).to receive(:refresh)
14
14
  @test_object.save
15
15
  end
16
16
  end
@@ -1,57 +1,57 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
-
4
+
5
5
  before(:each) do
6
6
  @test_object = ActiveFedora::Base.new
7
7
  end
8
-
8
+
9
9
  describe '.generate_dsid' do
10
- it "should return a dsid that is not currently in use" do
11
- dsids = Hash["DS1"=>1, "DS2"=>1]
12
- @test_object.should_receive(:datastreams).and_return(dsids)
10
+ it 'should return a dsid that is not currently in use' do
11
+ dsids = Hash['DS1' => 1, 'DS2' => 1]
12
+ expect(@test_object).to receive(:datastreams).and_return(dsids)
13
13
  generated_id = @test_object.generate_dsid
14
- generated_id.should_not be_nil
15
- generated_id.should == "DS3"
14
+ expect(generated_id).not_to be_nil
15
+ expect(generated_id).to eq('DS3')
16
16
  end
17
- it "should accept a prefix argument, default to using DS as prefix" do
18
- @test_object.generate_dsid("FOO").should == "FOO1"
17
+ it 'should accept a prefix argument, default to using DS as prefix' do
18
+ expect(@test_object.generate_dsid('FOO')).to eq('FOO1')
19
19
  end
20
20
 
21
- it "if delete a datastream it should still use next index for a prefix" do
22
- dsids = Hash["DS2"=>1]
23
- @test_object.should_receive(:datastreams).and_return(dsids)
21
+ it 'if delete a datastream it should still use next index for a prefix' do
22
+ dsids = Hash['DS2' => 1]
23
+ expect(@test_object).to receive(:datastreams).and_return(dsids)
24
24
  generated_id = @test_object.generate_dsid
25
- generated_id.should_not be_nil
26
- generated_id.should == "DS3"
25
+ expect(generated_id).not_to be_nil
26
+ expect(generated_id).to eq('DS3')
27
27
  end
28
28
  end
29
29
  describe '.add_datastream' do
30
- it "should not call Datastream.save" do
30
+ it 'should not call Datastream.save' do
31
31
  ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'ds_to_add')
32
- ds.should_receive(:save).never
32
+ expect(ds).to receive(:save).never
33
33
  @test_object.add_datastream(ds)
34
34
  end
35
- it "should add the datastream to the datastreams_in_memory array" do
35
+ it 'should add the datastream to the datastreams_in_memory array' do
36
36
  ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'ds_to_add')
37
- @test_object.datastreams.should_not have_key(ds.dsid)
37
+ expect(@test_object.datastreams).not_to have_key(ds.dsid)
38
38
  @test_object.add_datastream(ds)
39
- @test_object.datastreams.should have_key(ds.dsid)
39
+ expect(@test_object.datastreams).to have_key(ds.dsid)
40
40
  end
41
- it "should auto-assign dsids using auto-incremented integers if dsid is nil or an empty string" do
41
+ it 'should auto-assign dsids using auto-incremented integers if dsid is nil or an empty string' do
42
42
  ds = ActiveFedora::Datastream.new(@test_object.inner_object, nil)
43
- ds.dsid.should == nil
43
+ expect(ds.dsid).to be_nil
44
44
  ds_emptystringid = ActiveFedora::Datastream.new(@test_object.inner_object, '')
45
45
  @test_object.stub(:generate_dsid => 'foo')
46
46
  # ds.should_receive(:dsid=).with("foo")
47
- @test_object.add_datastream(ds).should == 'foo'
48
- @test_object.add_datastream(ds_emptystringid).should == 'foo'
47
+ expect(@test_object.add_datastream(ds)).to eq('foo')
48
+ expect(@test_object.add_datastream(ds_emptystringid)).to eq('foo')
49
49
  end
50
- it "should accept a prefix option and apply it to automatically assigned dsids" do
50
+ it 'should accept a prefix option and apply it to automatically assigned dsids' do
51
51
  ds = ActiveFedora::Datastream.new(@test_object.inner_object, nil)
52
- ds.dsid.should == nil
53
- @test_object.stub(:generate_dsid => "FOO")
54
- @test_object.add_datastream(ds, :prefix => "FOO").should == 'FOO'
52
+ expect(ds.dsid).to be_nil
53
+ @test_object.stub(:generate_dsid => 'FOO')
54
+ expect(@test_object.add_datastream(ds, :prefix => 'FOO')).to eq('FOO')
55
55
  end
56
56
  end
57
57
  end
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
4
  before :all do
5
- class BarStream2 < ActiveFedora::OmDatastream
5
+ class BarStream2 < ActiveFedora::OmDatastream
6
6
  set_terminology do |t|
7
- t.root(:path=>"animals", :xmlns=>"urn:zoobar")
7
+ t.root(:path => 'animals', :xmlns => 'urn:zoobar')
8
8
  t.waterfowl do
9
- t.ducks do
9
+ t.ducks do
10
10
  t.duck
11
11
  end
12
12
  end
@@ -17,7 +17,7 @@ describe ActiveFedora::Base do
17
17
  end
18
18
 
19
19
  def self.xml_template
20
- Nokogiri::XML::Document.parse '<animals xmlns="urn:zoobar">
20
+ Nokogiri::XML::Document.parse '<animals xmlns="urn:zoobar">
21
21
  <waterfowl>
22
22
  <ducks>
23
23
  <duck/>
@@ -33,28 +33,28 @@ describe ActiveFedora::Base do
33
33
  Object.send(:remove_const, :BarStream2)
34
34
  end
35
35
 
36
- describe "first level delegation" do
36
+ describe 'first level delegation' do
37
37
  before :all do
38
38
  class BarHistory2 < ActiveFedora::Base
39
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
40
- m.field "fubar", :string
41
- m.field "bandana", :string
42
- m.field "swank", :text
39
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'someData' do |m|
40
+ m.field 'fubar', :string
41
+ m.field 'bandana', :string
42
+ m.field 'swank', :text
43
43
  end
44
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"withText" do |m|
45
- m.field "fubar", :text
44
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'withText' do |m|
45
+ m.field 'fubar', :text
46
46
  end
47
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"withText2", :label=>"withLabel" do |m|
48
- m.field "fubar", :text
49
- end
50
-
51
- has_metadata :type=>BarStream2, :name=>"xmlish"
52
- delegate :fubar, :to=>'withText', :unique=>true
53
- delegate :donkey, :to=>'xmlish', :unique=>true
54
- delegate :cow, :to=>'xmlish' # for testing the default value of multiple
55
- delegate :pig, :to=>'xmlish', multiple: false
56
- delegate :horse, :to=>'xmlish', multiple: true
57
- delegate :duck, :to=>'xmlish', :at=>[:waterfowl, :ducks], multiple: true
47
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'withText2', :label => 'withLabel' do |m|
48
+ m.field 'fubar', :text
49
+ end
50
+
51
+ has_metadata :type => BarStream2, :name => 'xmlish'
52
+ delegate :fubar, :to => 'withText', :unique => true
53
+ delegate :donkey, :to => 'xmlish', :unique => true
54
+ delegate :cow, :to => 'xmlish' # for testing the default value of multiple
55
+ delegate :pig, :to => 'xmlish', multiple: false
56
+ delegate :horse, :to => 'xmlish', multiple: true
57
+ delegate :duck, :to => 'xmlish', :at => [:waterfowl, :ducks], multiple: true
58
58
  end
59
59
  end
60
60
 
@@ -64,58 +64,58 @@ describe ActiveFedora::Base do
64
64
 
65
65
  subject { BarHistory2.new() }
66
66
 
67
- it "should reveal the unique properties" do
68
- BarHistory2.unique?(:fubar).should be_true
69
- BarHistory2.unique?(:cow).should be_false
67
+ it 'should reveal the unique properties' do
68
+ expect(BarHistory2.unique?(:fubar)).to be_truthy
69
+ expect(BarHistory2.unique?(:cow)).to be_falsey
70
70
  end
71
71
 
72
- it "should save a delegated property uniquely" do
73
- subject.fubar="Quack"
74
- subject.fubar.should == "Quack"
75
- subject.withText.get_values(:fubar).first.should == 'Quack'
76
- subject.donkey="Bray"
77
- subject.donkey.should == "Bray"
78
- subject.xmlish.term_values(:donkey).first.should == 'Bray'
72
+ it 'should save a delegated property uniquely' do
73
+ subject.fubar = 'Quack'
74
+ expect(subject.fubar).to eq('Quack')
75
+ expect(subject.withText.get_values(:fubar).first).to eq('Quack')
76
+ subject.donkey = 'Bray'
77
+ expect(subject.donkey).to eq('Bray')
78
+ expect(subject.xmlish.term_values(:donkey).first).to eq('Bray')
79
79
 
80
- subject.pig="Oink"
81
- subject.pig.should == "Oink"
80
+ subject.pig = 'Oink'
81
+ expect(subject.pig).to eq('Oink')
82
82
  end
83
83
 
84
- it "should allow passing parameters to the delegate accessor" do
85
- subject.cow=["one", "two"]
86
- subject.cow(1).should == ['two']
84
+ it 'should allow passing parameters to the delegate accessor' do
85
+ subject.cow = ['one', 'two']
86
+ expect(subject.cow(1)).to eq(['two'])
87
87
  end
88
88
 
89
89
 
90
- it "should return an array if not marked as unique" do
90
+ it 'should return an array if not marked as unique' do
91
91
  ### Metadata datastream does not appear to support multiple value setting
92
- subject.cow=["one", "two"]
93
- subject.cow.should == ["one", "two"]
92
+ subject.cow = ['one', 'two']
93
+ expect(subject.cow).to eq(['one', 'two'])
94
94
 
95
- subject.horse=["neigh", "whinny"]
96
- subject.horse.should == ["neigh", "whinny"]
95
+ subject.horse = ['neigh', 'whinny']
96
+ expect(subject.horse).to eq(['neigh', 'whinny'])
97
97
  end
98
98
 
99
- it "should be able to delegate deeply into the terminology" do
100
- subject.duck=["Quack", "Peep"]
101
- subject.duck.should == ["Quack", "Peep"]
99
+ it 'should be able to delegate deeply into the terminology' do
100
+ subject.duck = ['Quack', 'Peep']
101
+ expect(subject.duck).to eq(['Quack', 'Peep'])
102
102
  end
103
103
 
104
- it "should be able to track change status" do
105
- subject.fubar_changed?.should be_false
106
- subject.fubar = "Meow"
107
- subject.fubar_changed?.should be_true
104
+ it 'should be able to track change status' do
105
+ expect(subject.fubar_changed?).to be_falsey
106
+ subject.fubar = 'Meow'
107
+ expect(subject.fubar_changed?).to be_truthy
108
108
  end
109
109
 
110
- describe "array getters and setters" do
111
- it "should accept symbol keys" do
112
- subject[:duck]= ["Cluck", "Gobble"]
113
- subject[:duck].should == ["Cluck", "Gobble"]
110
+ describe 'array getters and setters' do
111
+ it 'should accept symbol keys' do
112
+ subject[:duck] = ['Cluck', 'Gobble']
113
+ expect(subject[:duck]).to eq(['Cluck', 'Gobble'])
114
114
  end
115
115
 
116
- it "should accept string keys" do
117
- subject['duck']= ["Cluck", "Gobble"]
118
- subject['duck'].should == ["Cluck", "Gobble"]
116
+ it 'should accept string keys' do
117
+ subject['duck'] = ['Cluck', 'Gobble']
118
+ expect(subject['duck']).to eq(['Cluck', 'Gobble'])
119
119
  end
120
120
 
121
121
  it "should raise an error on the reader when the field isn't delegated" do
@@ -123,16 +123,16 @@ describe ActiveFedora::Base do
123
123
  end
124
124
 
125
125
  it "should raise an error on the setter when the field isn't delegated" do
126
- expect {subject['goose']="honk" }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
126
+ expect {subject['goose'] = 'honk' }.to raise_error ActiveFedora::UnknownAttributeError, "BarHistory2 does not have an attribute `goose'"
127
127
  end
128
128
  end
129
129
 
130
130
  end
131
131
 
132
- describe "with a superclass" do
132
+ describe 'with a superclass' do
133
133
  before :all do
134
134
  class BarHistory2 < ActiveFedora::Base
135
- has_metadata 'xmlish', :type=>BarStream2
135
+ has_metadata 'xmlish', :type => BarStream2
136
136
  delegate_to 'xmlish', [:donkey, :cow], multiple: true
137
137
  end
138
138
  class BarHistory3 < BarHistory2
@@ -146,19 +146,19 @@ describe ActiveFedora::Base do
146
146
 
147
147
  subject { BarHistory3.new }
148
148
 
149
- it "should be able to delegate deeply into the terminology" do
150
- subject.donkey=["Bray", "Hee-haw"]
151
- subject.donkey.should == ["Bray", "Hee-haw"]
149
+ it 'should be able to delegate deeply into the terminology' do
150
+ subject.donkey = ['Bray', 'Hee-haw']
151
+ expect(subject.donkey).to eq(['Bray', 'Hee-haw'])
152
152
  end
153
153
 
154
- it "should be able to track change status" do
155
- subject.cow_changed?.should be_false
156
- subject.cow = ["Moo"]
157
- subject.cow_changed?.should be_true
158
- end
154
+ it 'should be able to track change status' do
155
+ expect(subject.cow_changed?).to be_falsey
156
+ subject.cow = ['Moo']
157
+ expect(subject.cow_changed?).to be_truthy
158
+ end
159
159
  end
160
160
 
161
- describe "with a RDF datastream" do
161
+ describe 'with a RDF datastream' do
162
162
  before :all do
163
163
  class BarRdfDatastream < ActiveFedora::NtriplesRDFDatastream
164
164
  map_predicates do |map|
@@ -167,7 +167,7 @@ describe ActiveFedora::Base do
167
167
  end
168
168
  end
169
169
  class BarHistory4 < ActiveFedora::Base
170
- has_metadata 'rdfish', :type=>BarRdfDatastream
170
+ has_metadata 'rdfish', :type => BarRdfDatastream
171
171
  delegate_to 'rdfish', [:title, :description], multiple: true
172
172
  end
173
173
  end
@@ -179,21 +179,19 @@ describe ActiveFedora::Base do
179
179
 
180
180
  subject { BarHistory4.new }
181
181
 
182
- describe "with a multivalued field" do
183
- it "should be able to track change status" do
184
- subject.title_changed?.should be_false
185
- subject.title = ["Title1", "Title2"]
186
- subject.title_changed?.should be_true
182
+ describe 'with a multivalued field' do
183
+ it 'should be able to track change status' do
184
+ expect(subject.title_changed?).to be_falsey
185
+ subject.title = ['Title1', 'Title2']
186
+ expect(subject.title_changed?).to be_truthy
187
187
  end
188
188
  end
189
- describe "with a single-valued field" do
190
- it "should be able to track change status" do
191
- subject.description_changed?.should be_false
192
- subject.description = "A brief description"
193
- subject.description_changed?.should be_true
189
+ describe 'with a single-valued field' do
190
+ it 'should be able to track change status' do
191
+ expect(subject.description_changed?).to be_falsey
192
+ subject.description = 'A brief description'
193
+ expect(subject.description_changed?).to be_truthy
194
194
  end
195
195
  end
196
- end
196
+ end
197
197
  end
198
-
199
-