active-fedora 6.7.8 → 6.8.0

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.
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,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "NestedAttribute behavior" do
3
+ describe 'NestedAttribute behavior' do
4
4
  before do
5
5
  class Bar < ActiveFedora::Base
6
- belongs_to :car, :property=>:has_member
7
- has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
8
- m.field "uno", :string
9
- m.field "dos", :string
6
+ belongs_to :car, :property => :has_member
7
+ has_metadata :type => ActiveFedora::SimpleDatastream, :name => 'someData' do |m|
8
+ m.field 'uno', :string
9
+ m.field 'dos', :string
10
10
  end
11
11
  delegate :uno, to: 'someData', multiple: false
12
12
  delegate :dos, to: 'someData', multiple: false
@@ -14,23 +14,23 @@ describe "NestedAttribute behavior" do
14
14
 
15
15
  # base Car class, used in test for association updates and :allow_destroy flag
16
16
  class Car < ActiveFedora::Base
17
- has_many :bars, :property=>:has_member
18
- accepts_nested_attributes_for :bars, :allow_destroy=>true
17
+ has_many :bars, :property => :has_member
18
+ accepts_nested_attributes_for :bars, :allow_destroy => true
19
19
  end
20
20
 
21
21
  # class used in test for :reject_if=>:all_blank
22
22
  class CarAllBlank < Car
23
- accepts_nested_attributes_for :bars, :reject_if=>:all_blank
23
+ accepts_nested_attributes_for :bars, :reject_if => :all_blank
24
24
  end
25
25
 
26
26
  # class used in test for :reject_if with proc object
27
27
  class CarProc < Car
28
- accepts_nested_attributes_for :bars, :reject_if=>proc { |attributes| attributes['uno'].blank? }
28
+ accepts_nested_attributes_for :bars, :reject_if => proc { |attributes| attributes['uno'].blank? }
29
29
  end
30
30
 
31
31
  # class used in test for :reject_if with method name as symbol
32
32
  class CarSymbol < Car
33
- accepts_nested_attributes_for :bars, :reject_if=>:uno_blank
33
+ accepts_nested_attributes_for :bars, :reject_if => :uno_blank
34
34
 
35
35
  def uno_blank(attributes)
36
36
  attributes['uno'].blank?
@@ -43,64 +43,64 @@ describe "NestedAttribute behavior" do
43
43
  end
44
44
  end
45
45
 
46
- it "should have _destroy" do
47
- Bar.new._destroy.should be_false
46
+ it 'should have _destroy' do
47
+ expect(Bar.new._destroy).to be_falsey
48
48
  end
49
49
 
50
- it "should update the child objects" do
50
+ it 'should update the child objects' do
51
51
  @car, @bar1, @bar2 = create_car_with_bars
52
52
 
53
- @car.attributes = {:bars_attributes=>[{:id=>@bar1.pid, :uno=>"bar1 uno"}, {:uno=>"newbar uno"}, {:id=>@bar2.pid, :_destroy=>'1', :uno=>'bar2 uno'}]}
54
- Bar.find(@bar1.pid).uno.should == 'bar1 uno'
55
- Bar.where(:id => @bar2.pid).first.should be_nil
56
- Bar.where(:uno => "newbar uno").first.should_not be_nil
53
+ @car.attributes = {:bars_attributes => [{:id => @bar1.pid, :uno => 'bar1 uno'}, {:uno => 'newbar uno'}, {:id => @bar2.pid, :_destroy => '1', :uno => 'bar2 uno'}]}
54
+ expect(Bar.find(@bar1.pid).uno).to eq('bar1 uno')
55
+ expect(Bar.where(:id => @bar2.pid).first).to be_nil
56
+ expect(Bar.where(:uno => 'newbar uno').first).not_to be_nil
57
57
 
58
58
  bars = @car.bars(true)
59
- bars.should include(@bar1)
60
- bars.should_not include(@bar2)
59
+ expect(bars).to include(@bar1)
60
+ expect(bars).not_to include(@bar2)
61
61
  end
62
62
 
63
- it "should reject attributes when all blank" do
63
+ it 'should reject attributes when all blank' do
64
64
  @car, @bar1, @bar2 = create_car_with_bars(CarAllBlank)
65
65
 
66
- @car.bars.count.should == 2
67
- @car.attributes = {:bars_attributes=>[{}, {:id=>@bar1.pid, :uno=>"bar1 uno"}]}
68
- @car.bars(true).count.should == 2
66
+ expect(@car.bars.count).to eq(2)
67
+ @car.attributes = {:bars_attributes => [{}, {:id => @bar1.pid, :uno => 'bar1 uno'}]}
68
+ expect(@car.bars(true).count).to eq(2)
69
69
 
70
70
  @bar1.reload
71
- @bar1.uno.should == "bar1 uno"
71
+ expect(@bar1.uno).to eq('bar1 uno')
72
72
  end
73
73
 
74
- it "should reject attributes based on proc" do
74
+ it 'should reject attributes based on proc' do
75
75
  @car, @bar1, @bar2 = create_car_with_bars(CarProc)
76
76
 
77
- @car.attributes = {:bars_attributes=>[{}, {:id=>@bar1.pid, :uno=>"bar1 uno"}, {:id=>@bar2.pid, :dos=>"bar2 dos"}]}
77
+ @car.attributes = {:bars_attributes => [{}, {:id => @bar1.pid, :uno => 'bar1 uno'}, {:id => @bar2.pid, :dos => 'bar2 dos'}]}
78
78
  @bar1.reload
79
79
  @bar2.reload
80
- @bar1.uno.should == "bar1 uno"
81
- @bar2.dos.should be_nil
80
+ expect(@bar1.uno).to eq('bar1 uno')
81
+ expect(@bar2.dos).to be_nil
82
82
  end
83
83
 
84
- it "should reject attributes base on method name" do
84
+ it 'should reject attributes base on method name' do
85
85
  @car, @bar1, @bar2 = create_car_with_bars(CarSymbol)
86
86
 
87
- @car.attributes = {:bars_attributes=>[{}, {:id=>@bar1.pid, :uno=>"bar1 uno"}, {:id=>@bar2.pid, :dos=>"bar2 dos"}]}
87
+ @car.attributes = {:bars_attributes => [{}, {:id => @bar1.pid, :uno => 'bar1 uno'}, {:id => @bar2.pid, :dos => 'bar2 dos'}]}
88
88
  @bar1.reload
89
89
  @bar2.reload
90
- @bar1.uno.should == "bar1 uno"
91
- @bar2.dos.should be_nil
90
+ expect(@bar1.uno).to eq('bar1 uno')
91
+ expect(@bar2.dos).to be_nil
92
92
  end
93
93
 
94
- it "should throw TooManyRecords" do
94
+ it 'should throw TooManyRecords' do
95
95
  @car, @bar1, @bar2 = create_car_with_bars(CarWithLimit)
96
96
 
97
- lambda {
98
- @car.attributes = {:bars_attributes=>[{}]}
99
- }.should_not raise_exception
97
+ expect {
98
+ @car.attributes = {:bars_attributes => [{}]}
99
+ }.not_to raise_exception
100
100
 
101
- lambda {
102
- @car.attributes = {:bars_attributes=>[{}, {}]}
103
- }.should raise_exception(ActiveFedora::NestedAttributes::TooManyRecords)
101
+ expect {
102
+ @car.attributes = {:bars_attributes => [{}, {}]}
103
+ }.to raise_exception(ActiveFedora::NestedAttributes::TooManyRecords)
104
104
  end
105
105
 
106
106
  private
@@ -114,8 +114,8 @@ describe "NestedAttribute behavior" do
114
114
  def create_car_with_bars(car_class = Car, bar_class = Bar)
115
115
  car = car_class.new; car.save
116
116
 
117
- bar1 = bar_class.new(:car=>car); bar1.save
118
- bar2 = bar_class.new(:car=>car); bar2.save
117
+ bar1 = bar_class.new(:car => car); bar1.save
118
+ bar2 = bar_class.new(:car => car); bar2.save
119
119
  [car, bar1, bar2]
120
120
  end
121
121
 
@@ -7,17 +7,17 @@ describe ActiveFedora::NtriplesRDFDatastream do
7
7
  map.title(:in => RDF::DC) do |index|
8
8
  index.as :stored_searchable, :facetable
9
9
  end
10
- map.date_uploaded(:to => "dateSubmitted", :in => RDF::DC) do |index|
10
+ map.date_uploaded(:to => 'dateSubmitted', :in => RDF::DC) do |index|
11
11
  index.type :date
12
12
  index.as :stored_searchable, :sortable
13
13
  end
14
- map.part(:to => "hasPart", :in => RDF::DC)
14
+ map.part(:to => 'hasPart', :in => RDF::DC)
15
15
  map.based_near(:in => RDF::FOAF)
16
- map.related_url(:to => "seeAlso", :in => RDF::RDFS)
16
+ map.related_url(:to => 'seeAlso', :in => RDF::RDFS)
17
17
  end
18
18
  end
19
- class RdfTest < ActiveFedora::Base
20
- has_metadata :name=>'rdf', :type=>MyDatastream
19
+ class RdfTest < ActiveFedora::Base
20
+ has_metadata :name => 'rdf', :type => MyDatastream
21
21
  delegate_to 'rdf', [:based_near, :related_url, :part, :date_uploaded], multiple: true
22
22
  delegate :title, to: 'rdf', multiple: false
23
23
  end
@@ -33,105 +33,105 @@ describe ActiveFedora::NtriplesRDFDatastream do
33
33
  Object.send(:remove_const, :MyDatastream)
34
34
  end
35
35
 
36
- it "should not try to send an empty datastream" do
36
+ it 'should not try to send an empty datastream' do
37
37
  @subject.save
38
38
  end
39
39
 
40
- it "should save content properly upon save" do
41
- foo = RdfTest.new(:pid=>'test:1') #Pid needs to match the subject in the loaded file
40
+ it 'should save content properly upon save' do
41
+ foo = RdfTest.new(:pid => 'test:1') #Pid needs to match the subject in the loaded file
42
42
  foo.title = 'Hamlet'
43
43
  foo.save
44
- foo.title.should == 'Hamlet'
44
+ expect(foo.title).to eq('Hamlet')
45
45
  foo.rdf.content = File.new('spec/fixtures/mixed_rdf_descMetadata.nt').read
46
46
  foo.save
47
- foo.title.should == 'Title of work'
47
+ expect(foo.title).to eq('Title of work')
48
48
  end
49
49
 
50
- it "should delegate as_json to the fields" do
51
- @subject = RdfTest.new(title: "Title of work")
52
- @subject.rdf.title.as_json.should == ["Title of work"]
53
- @subject.rdf.title.to_json.should == "\[\"Title of work\"\]"
50
+ it 'should delegate as_json to the fields' do
51
+ @subject = RdfTest.new(title: 'Title of work')
52
+ expect(@subject.rdf.title.as_json).to eq(['Title of work'])
53
+ expect(@subject.rdf.title.to_json).to eq("\[\"Title of work\"\]")
54
54
  end
55
55
 
56
- it "should solrize even when the object is not new" do
56
+ it 'should solrize even when the object is not new' do
57
57
  foo = RdfTest.new
58
- foo.should_receive(:update_index).once
59
- foo.title = "title1"
58
+ expect(foo).to receive(:update_index).once
59
+ foo.title = 'title1'
60
60
  foo.save
61
61
  foo = RdfTest.find(foo.pid)
62
- foo.should_receive(:update_index).once
63
- foo.title = "The Work2"
64
- foo.save
62
+ expect(foo).to receive(:update_index).once
63
+ foo.title = 'The Work2'
64
+ foo.save
65
65
  end
66
66
 
67
- it "should serialize dates" do
67
+ it 'should serialize dates' do
68
68
  subject.date_uploaded = Date.parse('2012-11-02')
69
- subject.date_uploaded.first.should be_kind_of Date
69
+ expect(subject.date_uploaded.first).to be_kind_of Date
70
70
  solr_document = subject.to_solr
71
- solr_document[ActiveFedora::SolrService.solr_name('rdf__date_uploaded', type: :date)].should == ['2012-11-02T00:00:00Z']
71
+ expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__date_uploaded', type: :date)]).to eq(['2012-11-02T00:00:00Z'])
72
72
  end
73
73
 
74
- it "should produce a solr document" do
75
- @subject = RdfTest.new(title: "War and Peace")
74
+ it 'should produce a solr document' do
75
+ @subject = RdfTest.new(title: 'War and Peace')
76
76
  solr_document = @subject.to_solr
77
- solr_document[ActiveFedora::SolrService.solr_name('rdf__title', :facetable)].should == ["War and Peace"]
78
- solr_document[ActiveFedora::SolrService.solr_name('rdf__title', type: :string)].should == ["War and Peace"]
77
+ expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__title', :facetable)]).to eq(['War and Peace'])
78
+ expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__title', type: :string)]).to eq(['War and Peace'])
79
79
  end
80
80
 
81
- it "should set and recall values" do
81
+ it 'should set and recall values' do
82
82
  @subject.title = 'War and Peace'
83
- @subject.rdf.should be_changed
84
- @subject.based_near = "Moscow, Russia"
85
- @subject.related_url = "http://en.wikipedia.org/wiki/War_and_Peace"
86
- @subject.part = "this is a part"
83
+ expect(@subject.rdf).to be_changed
84
+ @subject.based_near = 'Moscow, Russia'
85
+ @subject.related_url = 'http://en.wikipedia.org/wiki/War_and_Peace'
86
+ @subject.part = 'this is a part'
87
87
  @subject.save
88
- @subject.title.should == 'War and Peace'
89
- @subject.based_near.should == ["Moscow, Russia"]
90
- @subject.related_url.should == ["http://en.wikipedia.org/wiki/War_and_Peace"]
91
- @subject.part.should == ["this is a part"]
88
+ expect(@subject.title).to eq('War and Peace')
89
+ expect(@subject.based_near).to eq(['Moscow, Russia'])
90
+ expect(@subject.related_url).to eq(['http://en.wikipedia.org/wiki/War_and_Peace'])
91
+ expect(@subject.part).to eq(['this is a part'])
92
92
  end
93
- it "should set, persist, and recall values" do
93
+ it 'should set, persist, and recall values' do
94
94
  @subject.title = 'War and Peace'
95
- @subject.based_near = "Moscow, Russia"
96
- @subject.related_url = "http://en.wikipedia.org/wiki/War_and_Peace"
97
- @subject.part = "this is a part"
95
+ @subject.based_near = 'Moscow, Russia'
96
+ @subject.related_url = 'http://en.wikipedia.org/wiki/War_and_Peace'
97
+ @subject.part = 'this is a part'
98
98
  @subject.save
99
99
 
100
100
  loaded = RdfTest.find(@subject.pid)
101
- loaded.title.should == 'War and Peace'
102
- loaded.based_near.should == ['Moscow, Russia']
103
- loaded.related_url.should == ['http://en.wikipedia.org/wiki/War_and_Peace']
104
- loaded.part.should == ['this is a part']
101
+ expect(loaded.title).to eq('War and Peace')
102
+ expect(loaded.based_near).to eq(['Moscow, Russia'])
103
+ expect(loaded.related_url).to eq(['http://en.wikipedia.org/wiki/War_and_Peace'])
104
+ expect(loaded.part).to eq(['this is a part'])
105
105
  end
106
- it "should set multiple values" do
107
- @subject.part = ["part 1", "part 2"]
106
+ it 'should set multiple values' do
107
+ @subject.part = ['part 1', 'part 2']
108
108
  @subject.save
109
109
 
110
110
  loaded = RdfTest.find(@subject.pid)
111
- loaded.part.should == ['part 1', 'part 2']
111
+ expect(loaded.part).to eq(['part 1', 'part 2'])
112
112
  end
113
- it "should append values" do
114
- @subject.part = "thing 1"
113
+ it 'should append values' do
114
+ @subject.part = 'thing 1'
115
115
  @subject.save
116
116
 
117
- @subject.part << "thing 2"
118
- @subject.part.should == ["thing 1", "thing 2"]
117
+ @subject.part << 'thing 2'
118
+ expect(@subject.part).to eq(['thing 1', 'thing 2'])
119
119
  end
120
120
 
121
- it "should be able to save a blank document" do
122
- @subject.title = ""
121
+ it 'should be able to save a blank document' do
122
+ @subject.title = ''
123
123
  @subject.save
124
124
  end
125
125
 
126
- it "should load n-triples into the graph" do
126
+ it 'should load n-triples into the graph' do
127
127
  ntrip = '<http://oregondigital.org/ns/62> <http://purl.org/dc/terms/type> "Image" .
128
128
  <http://oregondigital.org/ns/62> <http://purl.org/dc/terms/spatial> "Benton County (Ore.)" .
129
129
  '
130
130
  @subject.rdf.content = ntrip
131
- @subject.rdf.graph.dump(:ntriples).should == ntrip
131
+ expect(@subject.rdf.graph.dump(:ntriples)).to eq(ntrip)
132
132
  end
133
133
 
134
- describe "using rdf_subject" do
134
+ describe 'using rdf_subject' do
135
135
  before do
136
136
  # reopening existing class
137
137
  class MyDatastream < ActiveFedora::NtriplesRDFDatastream
@@ -146,12 +146,12 @@ describe ActiveFedora::NtriplesRDFDatastream do
146
146
  @subject.destroy
147
147
  end
148
148
 
149
- it "should write rdf with proper subjects" do
149
+ it 'should write rdf with proper subjects' do
150
150
  @subject.inner_object.pid = 'test:99'
151
- @subject.rdf.type = "Frog"
151
+ @subject.rdf.type = 'Frog'
152
152
  @subject.save!
153
153
  @subject.reload
154
- @subject.rdf.graph.dump(:ntriples).should == "<http://oregondigital.org/ns/99> <http://purl.org/dc/terms/type> \"Frog\" .\n"
154
+ expect(@subject.rdf.graph.dump(:ntriples)).to eq("<http://oregondigital.org/ns/99> <http://purl.org/dc/terms/type> \"Frog\" .\n")
155
155
  @subject.rdf.type == ['Frog']
156
156
 
157
157
  end
@@ -159,49 +159,49 @@ describe ActiveFedora::NtriplesRDFDatastream do
159
159
  end
160
160
 
161
161
 
162
- it "should delete values" do
163
- @subject.title = "Hamlet"
164
- @subject.related_url = "http://psu.edu/"
165
- @subject.related_url << "http://projecthydra.org/"
162
+ it 'should delete values' do
163
+ @subject.title = 'Hamlet'
164
+ @subject.related_url = 'http://psu.edu/'
165
+ @subject.related_url << 'http://projecthydra.org/'
166
166
 
167
- @subject.title.should == "Hamlet"
168
- @subject.related_url.should include("http://psu.edu/")
169
- @subject.related_url.should include("http://projecthydra.org/")
167
+ expect(@subject.title).to eq('Hamlet')
168
+ expect(@subject.related_url).to include('http://psu.edu/')
169
+ expect(@subject.related_url).to include('http://projecthydra.org/')
170
170
 
171
- @subject.title = "" #empty string can be meaningful, don't assume delete.
172
- @subject.title.should == ''
171
+ @subject.title = '' #empty string can be meaningful, don't assume delete.
172
+ expect(@subject.title).to eq('')
173
173
 
174
174
  @subject.title = nil
175
- @subject.related_url.delete("http://projecthydra.org/")
176
-
177
- @subject.title.should be_nil
178
- @subject.related_url.should == ["http://psu.edu/"]
179
- end
180
- it "should delete multiple values at once" do
181
- @subject.part = "MacBeth"
182
- @subject.part << "Hamlet"
183
- @subject.part << "Romeo & Juliet"
184
- @subject.part.first.should == "MacBeth"
185
- @subject.part.delete("MacBeth", "Romeo & Juliet")
186
- @subject.part.should == ["Hamlet"]
187
- @subject.part.first.should == "Hamlet"
188
- end
189
- it "should ignore values to be deleted that do not exist" do
190
- @subject.part = ["title1", "title2", "title3"]
191
- @subject.part.delete("title2", "title4", "title6")
192
- @subject.part.should == ["title1", "title3"]
193
- end
194
- describe "term proxy methods" do
175
+ @subject.related_url.delete('http://projecthydra.org/')
176
+
177
+ expect(@subject.title).to be_nil
178
+ expect(@subject.related_url).to eq(['http://psu.edu/'])
179
+ end
180
+ it 'should delete multiple values at once' do
181
+ @subject.part = 'MacBeth'
182
+ @subject.part << 'Hamlet'
183
+ @subject.part << 'Romeo & Juliet'
184
+ expect(@subject.part.first).to eq('MacBeth')
185
+ @subject.part.delete('MacBeth', 'Romeo & Juliet')
186
+ expect(@subject.part).to eq(['Hamlet'])
187
+ expect(@subject.part.first).to eq('Hamlet')
188
+ end
189
+ it 'should ignore values to be deleted that do not exist' do
190
+ @subject.part = ['title1', 'title2', 'title3']
191
+ @subject.part.delete('title2', 'title4', 'title6')
192
+ expect(@subject.part).to eq(['title1', 'title3'])
193
+ end
194
+ describe 'term proxy methods' do
195
195
  before(:each) do
196
196
  class TitleDatastream < ActiveFedora::NtriplesRDFDatastream
197
197
  map_predicates { |map| map.title(:in => RDF::DC) }
198
198
  end
199
- class Foobar < ActiveFedora::Base
200
- has_metadata :name=>'rdf', :type=>TitleDatastream
201
- delegate :title, :to=>'rdf', multiple: true
199
+ class Foobar < ActiveFedora::Base
200
+ has_metadata :name => 'rdf', :type => TitleDatastream
201
+ delegate :title, :to => 'rdf', multiple: true
202
202
  end
203
203
  @subject = Foobar.new
204
- @subject.title = ["title1", "title2", "title3"]
204
+ @subject.title = ['title1', 'title2', 'title3']
205
205
  end
206
206
 
207
207
  after(:each) do
@@ -209,26 +209,26 @@ describe ActiveFedora::NtriplesRDFDatastream do
209
209
  Object.send(:remove_const, :TitleDatastream)
210
210
  end
211
211
 
212
- it "should support the count method to determine # of values" do
213
- @subject.title.count.should == 3
212
+ it 'should support the count method to determine # of values' do
213
+ expect(@subject.title.count).to eq(3)
214
214
  end
215
- it "should iterate over multiple values" do
216
- @subject.title.should respond_to(:each)
215
+ it 'should iterate over multiple values' do
216
+ expect(@subject.title).to respond_to(:each)
217
217
  end
218
- it "should get the first value" do
219
- @subject.title.first.should == "title1"
218
+ it 'should get the first value' do
219
+ expect(@subject.title.first).to eq('title1')
220
220
  end
221
- it "should evaluate equality predictably" do
222
- @subject.title.should == ["title1", "title2", "title3"]
221
+ it 'should evaluate equality predictably' do
222
+ expect(@subject.title).to eq(['title1', 'title2', 'title3'])
223
223
  end
224
- it "should support the empty? method" do
225
- @subject.title.should respond_to(:empty?)
226
- @subject.title.empty?.should be_false
227
- @subject.title.delete("title1", "title2", "title3")
228
- @subject.title.empty?.should be_true
224
+ it 'should support the empty? method' do
225
+ expect(@subject.title).to respond_to(:empty?)
226
+ expect(@subject.title.empty?).to be_falsey
227
+ @subject.title.delete('title1', 'title2', 'title3')
228
+ expect(@subject.title.empty?).to be_truthy
229
229
  end
230
- it "should support the is_a? method" do
231
- @subject.title.is_a?(Array).should == true
230
+ it 'should support the is_a? method' do
231
+ expect(@subject.title.is_a?(Array)).to eq(true)
232
232
  end
233
233
  end
234
234
  end