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,25 +1,28 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'active_fedora'
4
- require "nokogiri"
4
+ require 'nokogiri'
5
5
 
6
6
  describe ActiveFedora::Datastream do
7
-
7
+
8
8
  before(:each) do
9
9
  @test_object = ActiveFedora::Base.new
10
10
  @test_datastream = ActiveFedora::Datastream.new(@test_object.inner_object, 'abcd')
11
- @test_datastream.content = "hi there"
11
+ @test_datastream.content = 'hi there'
12
12
  end
13
13
 
14
- its(:metadata?) { should be_false}
14
+ describe '#metadata?' do
15
+ subject { super().metadata? }
16
+ it { is_expected.to be_falsey}
17
+ end
15
18
 
16
- it "should escape dots in to_param" do
17
- @test_datastream.stub(:dsid).and_return('foo.bar')
18
- @test_datastream.to_param.should == 'foo%2ebar'
19
+ it 'should escape dots in to_param' do
20
+ allow(@test_datastream).to receive(:dsid).and_return('foo.bar')
21
+ expect(@test_datastream.to_param).to eq('foo%2ebar')
19
22
  end
20
-
21
- it "should be inspectable" do
22
- @test_datastream.inspect.should match /#<ActiveFedora::Datastream @pid=\"\" @dsid=\"abcd\" @controlGroup=\"M\" changed=\"true\" @mimeType=\"\" >/
23
+
24
+ it 'should be inspectable' do
25
+ expect(@test_datastream.inspect).to match /#<ActiveFedora::Datastream @pid=\"\" @dsid=\"abcd\" @controlGroup=\"M\" changed=\"true\" @mimeType=\"\" >/
23
26
  end
24
27
 
25
28
  describe '#validate_content_present' do
@@ -28,65 +31,65 @@ describe ActiveFedora::Datastream do
28
31
  @test_datastream.dsLocation = nil
29
32
  end
30
33
 
31
- it "should expect content on an Inline (X) datastream" do
34
+ it 'should expect content on an Inline (X) datastream' do
32
35
  @test_datastream.controlGroup = 'X'
33
- @test_datastream.dsLocation = "http://example.com/test/content/abcd"
34
- @test_datastream.validate_content_present.should be_false
35
- @test_datastream.content = "<foo><xmlelement/></foo>"
36
- @test_datastream.validate_content_present.should be_true
36
+ @test_datastream.dsLocation = 'http://example.com/test/content/abcd'
37
+ expect(@test_datastream.validate_content_present).to be_falsey
38
+ @test_datastream.content = '<foo><xmlelement/></foo>'
39
+ expect(@test_datastream.validate_content_present).to be_truthy
37
40
  end
38
41
 
39
- context "on a Managed (M) datastream" do
42
+ context 'on a Managed (M) datastream' do
40
43
  before { @test_datastream.controlGroup = 'M' }
41
- it "should be false when neither dsLocation nor content is present" do
42
- @test_datastream.validate_content_present.should be_false
44
+ it 'should be false when neither dsLocation nor content is present' do
45
+ expect(@test_datastream.validate_content_present).to be_falsey
43
46
  end
44
- it "should be true when dsLocation is present" do
45
- @test_datastream.dsLocation = "http://example.com/test/content/abcd"
46
- @test_datastream.validate_content_present.should be_true
47
+ it 'should be true when dsLocation is present' do
48
+ @test_datastream.dsLocation = 'http://example.com/test/content/abcd'
49
+ expect(@test_datastream.validate_content_present).to be_truthy
47
50
  end
48
- it "should be true when content is present" do
49
- @test_datastream.content = "<foo><xmlelement/></foo>"
50
- @test_datastream.validate_content_present.should be_true
51
+ it 'should be true when content is present' do
52
+ @test_datastream.content = '<foo><xmlelement/></foo>'
53
+ expect(@test_datastream.validate_content_present).to be_truthy
51
54
  end
52
55
  end
53
56
 
54
- it "should expect a dsLocation on an External (E) datastream" do
57
+ it 'should expect a dsLocation on an External (E) datastream' do
55
58
  @test_datastream.controlGroup = 'E'
56
- @test_datastream.content = "<foo><xmlelement/></foo>"
57
- @test_datastream.validate_content_present.should be_false
58
- @test_datastream.dsLocation = "http://example.com/test/content/abcd"
59
- @test_datastream.validate_content_present.should be_true
60
- @test_datastream.should be_external
59
+ @test_datastream.content = '<foo><xmlelement/></foo>'
60
+ expect(@test_datastream.validate_content_present).to be_falsey
61
+ @test_datastream.dsLocation = 'http://example.com/test/content/abcd'
62
+ expect(@test_datastream.validate_content_present).to be_truthy
63
+ expect(@test_datastream).to be_external
61
64
  end
62
65
 
63
- it "should expect a dsLocation on a Redirect (R) datastream" do
66
+ it 'should expect a dsLocation on a Redirect (R) datastream' do
64
67
  @test_datastream.controlGroup = 'R'
65
- @test_datastream.content = "<foo><xmlelement/></foo>"
66
- @test_datastream.validate_content_present.should be_false
67
- @test_datastream.dsLocation = "http://example.com/test/content/abcd"
68
- @test_datastream.validate_content_present.should be_true
68
+ @test_datastream.content = '<foo><xmlelement/></foo>'
69
+ expect(@test_datastream.validate_content_present).to be_falsey
70
+ @test_datastream.dsLocation = 'http://example.com/test/content/abcd'
71
+ expect(@test_datastream.validate_content_present).to be_truthy
69
72
  end
70
73
  end
71
-
72
- it "should have mimeType accessors" do
74
+
75
+ it 'should have mimeType accessors' do
73
76
  ds1 = ActiveFedora::Datastream.new
74
- ds1.mimeType = "text/foo"
75
- ds1.mimeType.should == "text/foo"
77
+ ds1.mimeType = 'text/foo'
78
+ expect(ds1.mimeType).to eq('text/foo')
76
79
  ds2 = ActiveFedora::Datastream.new
77
- ds2.mimeType = "text/bar"
78
- ds2.mimeType.should == "text/bar"
80
+ ds2.mimeType = 'text/bar'
81
+ expect(ds2.mimeType).to eq('text/bar')
79
82
  end
80
83
 
81
- describe ".size" do
82
- it "should lazily load the datastream size attribute from the fedora repository" do
84
+ describe '.size' do
85
+ it 'should lazily load the datastream size attribute from the fedora repository' do
83
86
  ds_profile = <<-EOS
84
- <datastreamProfile
85
- xmlns=\"http://www.fedora.info/definitions/1/0/management/\"
86
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
87
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
88
- xsi:schemaLocation=\"http://www.fedora.info/definitions/1/0/management/ http://www.fedora.info/definitions/1/0/datastreamProfile.xsd\"
89
- pid=\"#{@test_object.pid}\"
87
+ <datastreamProfile
88
+ xmlns=\"http://www.fedora.info/definitions/1/0/management/\"
89
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
90
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
91
+ xsi:schemaLocation=\"http://www.fedora.info/definitions/1/0/management/ http://www.fedora.info/definitions/1/0/datastreamProfile.xsd\"
92
+ pid=\"#{@test_object.pid}\"
90
93
  dsID=\"#{@test_datastream.dsid}\" >
91
94
  <dsLabel></dsLabel>
92
95
  <dsVersionID>#{@test_datastream.dsid}.1</dsVersionID>
@@ -106,13 +109,13 @@ describe ActiveFedora::Datastream do
106
109
  EOS
107
110
 
108
111
  mock_repo = Rubydora::Repository.new
109
- @test_object.inner_object.stub(:repository).and_return(mock_repo)
110
- mock_repo.api.should_receive(:datastream).with(:dsid => 'abcd', :pid => @test_object.pid).and_return(ds_profile)
111
- @test_datastream.size.should == 9999
112
+ allow(@test_object.inner_object).to receive(:repository).and_return(mock_repo)
113
+ expect(mock_repo.api).to receive(:datastream).with(:dsid => 'abcd', :pid => @test_object.pid).and_return(ds_profile)
114
+ expect(@test_datastream.size).to eq(9999)
112
115
  end
113
116
 
114
- it "should default to an empty string if ds has not been saved" do
115
- @test_datastream.size.should be_nil
117
+ it 'should default to an empty string if ds has not been saved' do
118
+ expect(@test_datastream.size).to be_nil
116
119
  end
117
120
  end
118
121
  end
@@ -11,16 +11,16 @@ describe ActiveFedora::Datastreams do
11
11
  end
12
12
  end
13
13
 
14
- it "should have a ds_specs entry" do
15
- FooHistory.ds_specs.should have_key('dsid')
14
+ it 'should have a ds_specs entry' do
15
+ expect(FooHistory.ds_specs).to have_key('dsid')
16
16
  end
17
17
 
18
- it "should have reasonable defaults" do
19
- FooHistory.ds_specs['dsid'].should include(:autocreate => false)
18
+ it 'should have reasonable defaults' do
19
+ expect(FooHistory.ds_specs['dsid']).to include(:autocreate => false)
20
20
  end
21
21
 
22
- it "should let you override defaults" do
23
- FooHistory.ds_specs['complex_ds'].should include(:versionable => true, :autocreate => true, :type => 'Z', :label => 'My Label', :control_group => 'Z')
22
+ it 'should let you override defaults' do
23
+ expect(FooHistory.ds_specs['complex_ds']).to include(:versionable => true, :autocreate => true, :type => 'Z', :label => 'My Label', :control_group => 'Z')
24
24
  end
25
25
  end
26
26
 
@@ -32,90 +32,90 @@ describe ActiveFedora::Datastreams do
32
32
  end
33
33
  end
34
34
 
35
- it "should have reasonable defaults" do
36
- FooHistory.ds_specs['dsid'].should include(:type => ActiveFedora::Datastream, :label => 'File Datastream', :control_group => 'M')
37
- FooHistory.ds_specs['another'].should include(:type => ActiveFedora::Datastream, :label => 'File Datastream', :control_group => 'M')
35
+ it 'should have reasonable defaults' do
36
+ expect(FooHistory.ds_specs['dsid']).to include(:type => ActiveFedora::Datastream, :label => 'File Datastream', :control_group => 'M')
37
+ expect(FooHistory.ds_specs['another']).to include(:type => ActiveFedora::Datastream, :label => 'File Datastream', :control_group => 'M')
38
38
  end
39
39
  end
40
40
 
41
- describe "#serialize_datastreams" do
42
- it "should touch each datastream" do
41
+ describe '#serialize_datastreams' do
42
+ it 'should touch each datastream' do
43
43
  m1 = double()
44
44
  m2 = double()
45
45
 
46
- m1.should_receive(:serialize!)
47
- m2.should_receive(:serialize!)
46
+ expect(m1).to receive(:serialize!)
47
+ expect(m2).to receive(:serialize!)
48
48
  subject.stub(:datastreams => { :m1 => m1, :m2 => m2})
49
49
  subject.serialize_datastreams
50
50
  end
51
51
  end
52
52
 
53
- describe "#add_disseminator_location_to_datastreams" do
54
- it "should infer dsLocations for E datastreams without hitting Fedora" do
55
-
53
+ describe '#add_disseminator_location_to_datastreams' do
54
+ it 'should infer dsLocations for E datastreams without hitting Fedora' do
55
+
56
56
  mock_specs = {:e => { :disseminator => 'xyz' }}
57
57
  mock_ds = double(:controlGroup => 'E')
58
58
  ActiveFedora::Base.stub(:ds_specs => mock_specs)
59
59
  ActiveFedora.stub(:config_for_environment => { :url => 'http://localhost'})
60
60
  subject.stub(:pid => 'test:1', :datastreams => {:e => mock_ds})
61
- mock_ds.should_receive(:dsLocation=).with("http://localhost/objects/test:1/methods/xyz")
61
+ expect(mock_ds).to receive(:dsLocation=).with('http://localhost/objects/test:1/methods/xyz')
62
62
  subject.add_disseminator_location_to_datastreams
63
63
  end
64
64
  end
65
65
 
66
- describe "#corresponding_datastream_name" do
66
+ describe '#corresponding_datastream_name' do
67
67
  before(:each) do
68
68
  subject.stub(:datastreams => { 'abc' => double(), 'a_b_c' => double(), 'a-b' => double()})
69
69
  end
70
70
 
71
- it "should use the name, if it exists" do
72
- subject.corresponding_datastream_name('abc').should == 'abc'
71
+ it 'should use the name, if it exists' do
72
+ expect(subject.corresponding_datastream_name('abc')).to eq('abc')
73
73
  end
74
74
 
75
- it "should hash-erize underscores" do
76
- subject.corresponding_datastream_name('a_b').should == 'a-b'
75
+ it 'should hash-erize underscores' do
76
+ expect(subject.corresponding_datastream_name('a_b')).to eq('a-b')
77
77
  end
78
78
 
79
- it "should return nil if nothing matches" do
80
- subject.corresponding_datastream_name('xyz').should be_nil
79
+ it 'should return nil if nothing matches' do
80
+ expect(subject.corresponding_datastream_name('xyz')).to be_nil
81
81
  end
82
82
  end
83
-
84
- describe "#datastreams" do
85
- it "should return the datastream hash proxy" do
86
- subject.stub(:load_datastreams)
87
- subject.datastreams.should be_a_kind_of(ActiveFedora::DatastreamHash)
83
+
84
+ describe '#datastreams' do
85
+ it 'should return the datastream hash proxy' do
86
+ allow(subject).to receive(:load_datastreams)
87
+ expect(subject.datastreams).to be_a_kind_of(ActiveFedora::DatastreamHash)
88
88
  end
89
89
 
90
- it "should round-trip to/from YAML" do
91
- YAML.load(subject.datastreams.to_yaml).inspect.should == subject.datastreams.inspect
90
+ it 'should round-trip to/from YAML' do
91
+ expect(YAML.load(subject.datastreams.to_yaml).inspect).to eq(subject.datastreams.inspect)
92
92
  end
93
93
  end
94
94
 
95
- describe "#configure_datastream" do
96
- it "should look up the ds_spec" do
95
+ describe '#configure_datastream' do
96
+ it 'should look up the ds_spec' do
97
97
  mock_dsspec = { :type => nil }
98
98
  subject.stub(:ds_specs => {'abc' => mock_dsspec})
99
99
  subject.configure_datastream(double(:dsid => 'abc'))
100
100
  end
101
101
 
102
- it "should be ok if there is no ds spec" do
102
+ it 'should be ok if there is no ds spec' do
103
103
  mock_dsspec = double()
104
104
  subject.stub(:ds_specs => {})
105
105
  subject.configure_datastream(double(:dsid => 'abc'))
106
106
  end
107
107
 
108
- it "should configure RelsExtDatastream" do
108
+ it 'should configure RelsExtDatastream' do
109
109
  mock_dsspec = { :type => ActiveFedora::RelsExtDatastream }
110
110
  subject.stub(:ds_specs => {'abc' => mock_dsspec})
111
111
 
112
112
  ds = double(:dsid => 'abc')
113
- ds.should_receive(:model=).with(subject)
113
+ expect(ds).to receive(:model=).with(subject)
114
114
 
115
115
  subject.configure_datastream(ds)
116
116
  end
117
117
 
118
- it "should run a Proc" do
118
+ it 'should run a Proc' do
119
119
  ds = double(:dsid => 'abc')
120
120
  @count = 0
121
121
  mock_dsspec = { :block => lambda { |x| @count += 1 } }
@@ -128,110 +128,110 @@ describe ActiveFedora::Datastreams do
128
128
  end
129
129
  end
130
130
 
131
- describe "#datastream_from_spec" do
132
- it "should fetch the rubydora datastream" do
133
- subject.inner_object.should_receive(:datastream_object_for).with('dsid', {}, {})
131
+ describe '#datastream_from_spec' do
132
+ it 'should fetch the rubydora datastream' do
133
+ expect(subject.inner_object).to receive(:datastream_object_for).with('dsid', {}, {})
134
134
  subject.datastream_from_spec({}, 'dsid')
135
135
  end
136
136
  end
137
137
 
138
- describe "#load_datastreams" do
139
- it "should load and configure persisted datastreams and should add any datastreams left over in the ds specs" do
140
- pending
138
+ describe '#load_datastreams' do
139
+ it 'should load and configure persisted datastreams and should add any datastreams left over in the ds specs' do
140
+ skip
141
141
  end
142
142
  end
143
143
 
144
- describe "#add_datastream" do
145
- it "should add the datastream to the object" do
144
+ describe '#add_datastream' do
145
+ it 'should add the datastream to the object' do
146
146
  ds = double(:dsid => 'Abc')
147
147
  subject.add_datastream(ds)
148
- subject.datastreams['Abc'].should == ds
148
+ expect(subject.datastreams['Abc']).to eq(ds)
149
149
  end
150
150
 
151
- it "should mint a dsid" do
151
+ it 'should mint a dsid' do
152
152
  ds = ActiveFedora::Datastream.new
153
- subject.add_datastream(ds).should == 'DS1'
153
+ expect(subject.add_datastream(ds)).to eq('DS1')
154
154
  end
155
155
  end
156
156
 
157
- describe "#metadata_streams" do
158
- it "should only be metadata datastreams" do
157
+ describe '#metadata_streams' do
158
+ it 'should only be metadata datastreams' do
159
159
  ds1 = double(:metadata? => true)
160
160
  ds2 = double(:metadata? => true)
161
161
  ds3 = double(:metadata? => true)
162
162
  relsextds = ActiveFedora::RelsExtDatastream.new
163
163
  file_ds = double(:metadata? => false)
164
164
  subject.stub(:datastreams => {:a => ds1, :b => ds2, :c => ds3, :d => relsextds, :e => file_ds})
165
- subject.metadata_streams.should include(ds1, ds2, ds3)
166
- subject.metadata_streams.should_not include(relsextds)
167
- subject.metadata_streams.should_not include(file_ds)
165
+ expect(subject.metadata_streams).to include(ds1, ds2, ds3)
166
+ expect(subject.metadata_streams).not_to include(relsextds)
167
+ expect(subject.metadata_streams).not_to include(file_ds)
168
168
  end
169
169
  end
170
170
 
171
- describe "#generate_dsid" do
172
- it "should create an autoincrementing dsid" do
173
- subject.generate_dsid('FOO').should == 'FOO1'
171
+ describe '#generate_dsid' do
172
+ it 'should create an autoincrementing dsid' do
173
+ expect(subject.generate_dsid('FOO')).to eq('FOO1')
174
174
  end
175
175
 
176
- it "should start from the highest existin dsid" do
176
+ it 'should start from the highest existin dsid' do
177
177
  subject.stub(:datastreams => {'FOO56' => double()})
178
- subject.generate_dsid('FOO').should == 'FOO57'
178
+ expect(subject.generate_dsid('FOO')).to eq('FOO57')
179
179
  end
180
180
  end
181
181
 
182
- describe "#relsext" do
183
- it "should be the RELS-EXT datastream" do
182
+ describe '#relsext' do
183
+ it 'should be the RELS-EXT datastream' do
184
184
  m = double
185
185
  subject.stub(:datastreams => { 'RELS-EXT' => m})
186
- subject.rels_ext.should == m
186
+ expect(subject.rels_ext).to eq(m)
187
187
  end
188
188
 
189
- it "should make one up otherwise" do
189
+ it 'should make one up otherwise' do
190
190
  subject.stub(:datastreams => {})
191
191
 
192
- subject.rels_ext.should be_a_kind_of(ActiveFedora::RelsExtDatastream)
192
+ expect(subject.rels_ext).to be_a_kind_of(ActiveFedora::RelsExtDatastream)
193
193
  end
194
194
  end
195
195
 
196
- describe "#add_file_datastream" do
196
+ describe '#add_file_datastream' do
197
197
  # tested elsewhere :/
198
- end
198
+ end
199
199
 
200
- describe "#create_datastream" do
201
- it "should mint a DSID" do
200
+ describe '#create_datastream' do
201
+ it 'should mint a DSID' do
202
202
  ds = subject.create_datastream(ActiveFedora::Datastream, nil, {})
203
- ds.dsid.should == 'DS1'
203
+ expect(ds.dsid).to eq('DS1')
204
204
  end
205
205
 
206
- it "should raise an argument error if the supplied dsid is nonsense" do
206
+ it 'should raise an argument error if the supplied dsid is nonsense' do
207
207
  expect { subject.create_datastream(ActiveFedora::Datastream, 0) }.to raise_error(ArgumentError)
208
208
  end
209
209
 
210
- it "should try to get a mime type from the blob" do
210
+ it 'should try to get a mime type from the blob' do
211
211
  mock_file = double(:content_type => 'x-application/asdf')
212
212
  ds = subject.create_datastream(ActiveFedora::Datastream, nil, {:blob => mock_file})
213
- ds.mimeType.should == 'x-application/asdf'
213
+ expect(ds.mimeType).to eq('x-application/asdf')
214
214
  end
215
215
 
216
- it "should provide a default mime type" do
216
+ it 'should provide a default mime type' do
217
217
  mock_file = double()
218
218
  ds = subject.create_datastream(ActiveFedora::Datastream, nil, {:blob => mock_file})
219
- ds.mimeType.should == 'application/octet-stream'
219
+ expect(ds.mimeType).to eq('application/octet-stream')
220
220
  end
221
221
 
222
- it "should use the filename as a default label" do
222
+ it 'should use the filename as a default label' do
223
223
  mock_file = double(:path => '/asdf/fdsa')
224
224
  ds = subject.create_datastream(ActiveFedora::Datastream, nil, {:blob => mock_file})
225
- ds.dsLabel.should == 'fdsa'
225
+ expect(ds.dsLabel).to eq('fdsa')
226
226
  end
227
227
  end
228
228
 
229
- describe "#additional_attributes_for_external_and_redirect_control_groups" do
229
+ describe '#additional_attributes_for_external_and_redirect_control_groups' do
230
230
  before(:all) do
231
231
  @behavior = ActiveFedora::Datastreams.deprecation_behavior
232
232
  ActiveFedora::Datastreams.deprecation_behavior = :silence
233
233
  end
234
-
234
+
235
235
  after :all do
236
236
  ActiveFedora::Datastreams.deprecation_behavior = @behavior
237
237
  end