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,14 @@
1
1
  require 'spec_helper'
2
2
  require 'timeout'
3
3
 
4
- describe "fedora_solr_sync_issues" do
4
+ describe 'fedora_solr_sync_issues' do
5
5
  before :all do
6
6
  class ParentThing < ActiveFedora::Base
7
- has_many :things, :class_name=>'ChildThing', :property=>:is_part_of
7
+ has_many :things, :class_name => 'ChildThing', :property => :is_part_of
8
8
  end
9
9
 
10
10
  class ChildThing < ActiveFedora::Base
11
- belongs_to :parent, :class_name=>'ParentThing', :property=>:is_part_of
11
+ belongs_to :parent, :class_name => 'ParentThing', :property => :is_part_of
12
12
  end
13
13
  end
14
14
 
@@ -20,9 +20,9 @@ describe "fedora_solr_sync_issues" do
20
20
  let(:parent) { ParentThing.create }
21
21
  subject { ChildThing.create :parent => parent }
22
22
 
23
- it "should not go into an infinite loop" do
23
+ it 'should not go into an infinite loop' do
24
24
  subject.inner_object.delete
25
25
  parent.reload
26
- parent.things.should == []
26
+ expect(parent.things).to eq([])
27
27
  end
28
28
  end
@@ -9,24 +9,24 @@ describe ActiveFedora::Base do
9
9
  class OralHistory < ActiveFedora::Base
10
10
  # These are all the properties that don't quite fit into Qualified DC
11
11
  # Put them on the object itself (in the properties datastream) for now.
12
- has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
13
- m.field "narrator", :string
14
- m.field "interviewer", :string
15
- m.field "transcript_editor", :text
16
- m.field "bio", :string
17
- m.field "notes", :text
18
- m.field "hard_copy_availability", :text
19
- m.field "hard_copy_location", :text
20
- m.field "other_contributor", :string
21
- m.field "restrictions", :text
22
- m.field "series", :string
23
- m.field "location", :string
12
+ has_metadata :name => 'properties', :type => ActiveFedora::SimpleDatastream do |m|
13
+ m.field 'narrator', :string
14
+ m.field 'interviewer', :string
15
+ m.field 'transcript_editor', :text
16
+ m.field 'bio', :string
17
+ m.field 'notes', :text
18
+ m.field 'hard_copy_availability', :text
19
+ m.field 'hard_copy_location', :text
20
+ m.field 'other_contributor', :string
21
+ m.field 'restrictions', :text
22
+ m.field 'series', :string
23
+ m.field 'location', :string
24
24
  end
25
-
26
-
27
- has_metadata :name=>"mods_article", :type=> Hydra::ModsArticleDatastream
28
-
29
- has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
25
+
26
+
27
+ has_metadata :name => 'mods_article', :type => Hydra::ModsArticleDatastream
28
+
29
+ has_metadata :name => 'dublin_core', :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
30
30
  # Default :multiple => true
31
31
  #
32
32
  # on retrieval, these will be pluralized and returned as arrays
@@ -34,30 +34,30 @@ describe ActiveFedora::Base do
34
34
  #
35
35
  # aimint to use method-missing to support calling methods like
36
36
  # my_oral_history.subjects OR my_oral_history.titles OR EVEN my_oral_history.title whenever possible
37
-
37
+
38
38
  # Setting new Types for dates and text content
39
39
  #m.field "creation_date", :date, :xml_node => "date"
40
40
  #m.field "abstract", :text, :xml_node => "abstract"
41
41
  #m.field "rights", :text, :xml_node => "rights"
42
-
42
+
43
43
  # Setting up special named fields
44
- #m.field "subject_heading", :string, :xml_node => "subject", :encoding => "LCSH"
44
+ #m.field "subject_heading", :string, :xml_node => "subject", :encoding => "LCSH"
45
45
  #m.field "spatial_coverage", :string, :xml_node => "spatial", :encoding => "TGN"
46
46
  #m.field "temporal_coverage", :string, :xml_node => "temporal", :encoding => "Period"
47
47
  #m.field "type", :string, :xml_node => "type", :encoding => "DCMITYPE"
48
48
  #m.field "alt_title", :string, :xml_node => "alternative"
49
49
  end
50
-
51
- has_metadata :name => "significant_passages", :type => ActiveFedora::SimpleDatastream do |m|
52
- m.field "significant_passage", :text
50
+
51
+ has_metadata :name => 'significant_passages', :type => ActiveFedora::SimpleDatastream do |m|
52
+ m.field 'significant_passage', :text
53
53
  end
54
-
55
- has_metadata :name => "sensitive_passages", :type => ActiveFedora::SimpleDatastream do |m|
56
- m.field "sensitive_passage", :text
54
+
55
+ has_metadata :name => 'sensitive_passages', :type => ActiveFedora::SimpleDatastream do |m|
56
+ m.field 'sensitive_passage', :text
57
57
  end
58
58
 
59
59
  end
60
- sample_location = "Boston, Massachusetts"
60
+ sample_location = 'Boston, Massachusetts'
61
61
  sample_notes = 'Addelson, Frances. (1973?) "The Induced Abortion," American Journal of Ortho-Psychiatry, Addelson, Frances. "Abortion: Source of Guilt or Growth," National Journal of Gynecology and Obstetrics., Addelson, Frances. "First Zionist Novel," Jewish Frontier.'
62
62
  sample_other_contributor = 'any other contributors, people or corporate names (eg. Temple Israel)'
63
63
  sample_transcript_editor = 'Siegel, Cheryl'
@@ -68,113 +68,113 @@ describe ActiveFedora::Base do
68
68
  sample_bio = <<-END
69
69
  Rochelle Ruthchild interviewed Frances Addleson on October 18, November 14, and December 10, 1997. The interview thoroughly examined the trajectory of Frances\' life from birth until the time of the interview. As a young child, Frances\' father died during the influenza epidemic, and her mother was not equipped to care for her and her siblings. Consequently, they were placed in a Jewish foster home. Although her experience was mostly positive, this experience would leave life-long effects. Frances attended Radcliffe upon the urging of a mentor and later obtained her Master\'s degree in social work from Simmons College in 1954. In the 1940\'s, she returned to work while her children were still young; a rather unusual event for that time period. While working as a social worker at Beth Israel Hospital in the early 1970\'s, she helped counsel countless women who came to the hospital seeking abortions before the procedure was officially legalized during the landmark Roe vs. Wade decision in 1973. Frances would later write two articles that were published in medical journals about her experience during this time. Although not a very religious person, Frances felt connected to the Jewish notion of social justice and remained very active until an accident in the late 1990\'s.
70
70
  END
71
- sample_interviewer = "Ruthchild, & Rochelle"
72
-
73
- @properties_sample_values2 = Hash[:narrator => "Narrator1 & Narrator2", :interviewer => "Interviewer", :transcript_editor => "Transcript Editor", :bio => "Biographic info",
74
- :notes => "My Note\\\'s a good one", :hard_copy_availability => "Yes", :hard_copy_location => "Archives", :other_contributor => "Sally Ride",
75
- :restrictions => "None", :series => "My Series", :location => "location"]
76
-
77
- @properties_sample_values = Hash[:narrator => sample_narrator, :interviewer => sample_interviewer, :transcript_editor => sample_transcript_editor, :bio => sample_bio,
78
- :notes => sample_notes, :hard_copy_availability => sample_hard_copy_availability, :hard_copy_location => "Archives", :other_contributor => sample_other_contributor,
79
- :restrictions => "None", :series => "My Series", :location => sample_location]
80
-
81
- @dublin_core_sample_values = Hash[:creator => 'Matt && McClain', :publisher => "Jewish Womens's Archive", :description => "description", :identifier => "jwa:sample_pid",
82
- :title => "title",
83
- #:alt_title => "alt_title", :subject => "subject",
84
- #:subject_heading => "subject heading",
85
- #:creation_date => "2008-07-02T05:09:42.015Z",
86
- :language => "language",
87
- #:spatial_coverage => "spatial coverage",
88
- #:temporal_coverage => "temporal coverage",
71
+ sample_interviewer = 'Ruthchild, & Rochelle'
72
+
73
+ @properties_sample_values2 = Hash[:narrator => 'Narrator1 & Narrator2', :interviewer => 'Interviewer', :transcript_editor => 'Transcript Editor', :bio => 'Biographic info',
74
+ :notes => "My Note\\\'s a good one", :hard_copy_availability => 'Yes', :hard_copy_location => 'Archives', :other_contributor => 'Sally Ride',
75
+ :restrictions => 'None', :series => 'My Series', :location => 'location']
76
+
77
+ @properties_sample_values = Hash[:narrator => sample_narrator, :interviewer => sample_interviewer, :transcript_editor => sample_transcript_editor, :bio => sample_bio,
78
+ :notes => sample_notes, :hard_copy_availability => sample_hard_copy_availability, :hard_copy_location => 'Archives', :other_contributor => sample_other_contributor,
79
+ :restrictions => 'None', :series => 'My Series', :location => sample_location]
80
+
81
+ @dublin_core_sample_values = Hash[:creator => 'Matt && McClain', :publisher => "Jewish Womens's Archive", :description => 'description', :identifier => 'jwa:sample_pid',
82
+ :title => 'title',
83
+ #:alt_title => "alt_title", :subject => "subject",
84
+ #:subject_heading => "subject heading",
85
+ #:creation_date => "2008-07-02T05:09:42.015Z",
86
+ :language => 'language',
87
+ #:spatial_coverage => "spatial coverage",
88
+ #:temporal_coverage => "temporal coverage",
89
89
  #:abstract => "abstract",
90
- :rights => "rights", :type => "type",
91
- #:extent => "extent",
92
- :format => "format", :medium => "medium"]
90
+ :rights => 'rights', :type => 'type',
91
+ #:extent => "extent",
92
+ :format => 'format', :medium => 'medium']
93
93
  @signigicant_passages_sample_values = {}
94
- @sensitive_passages_sample_values = {}
95
- @sample_xml = "<xml><fields><system_create_date>REMOVED</system_create_date><system_modified_date>REMOVED</system_modified_date><active_fedora_model_s>OralHistory</active_fedora_model_s><id>changeme:14527</id><subject_heading>subject heading</subject_heading><type>type</type><rights>rights</rights><publisher>publisher</publisher><creation_date>creation date</creation_date><identifier>jwa:sample_pid</identifier><format>format</format><extent>extent</extent><language>language</language><description>description</description><title>title</title><medium>medium</medium><spatial_coverage>spatial coverage</spatial_coverage><alt_title>alt_title</alt_title><temporal_coverage>temporal coverage</temporal_coverage><subject>subject</subject><creator>creator</creator><abstract>abstract</abstract><other_contributor>Sally Ride</other_contributor><transcript_editor>Transcript Editor</transcript_editor><restrictions>None</restrictions><bio>Biographic info</bio><series>My Series</series><notes>My Note</notes><location>location</location><hard_copy_availability>Yes</hard_copy_availability><narrator>Narrator</narrator><hard_copy_location>Archives</hard_copy_location><interviewer>Interviewer</interviewer></fields><content/></xml>"
96
-
97
- end
98
-
94
+ @sensitive_passages_sample_values = {}
95
+ @sample_xml = '<xml><fields><system_create_date>REMOVED</system_create_date><system_modified_date>REMOVED</system_modified_date><active_fedora_model_s>OralHistory</active_fedora_model_s><id>changeme:14527</id><subject_heading>subject heading</subject_heading><type>type</type><rights>rights</rights><publisher>publisher</publisher><creation_date>creation date</creation_date><identifier>jwa:sample_pid</identifier><format>format</format><extent>extent</extent><language>language</language><description>description</description><title>title</title><medium>medium</medium><spatial_coverage>spatial coverage</spatial_coverage><alt_title>alt_title</alt_title><temporal_coverage>temporal coverage</temporal_coverage><subject>subject</subject><creator>creator</creator><abstract>abstract</abstract><other_contributor>Sally Ride</other_contributor><transcript_editor>Transcript Editor</transcript_editor><restrictions>None</restrictions><bio>Biographic info</bio><series>My Series</series><notes>My Note</notes><location>location</location><hard_copy_availability>Yes</hard_copy_availability><narrator>Narrator</narrator><hard_copy_location>Archives</hard_copy_location><interviewer>Interviewer</interviewer></fields><content/></xml>'
96
+
97
+ end
98
+
99
99
  before(:each) do
100
100
  @test_history = OralHistory.new
101
101
  end
102
-
102
+
103
103
  after(:each) do
104
104
  end
105
-
105
+
106
106
  after(:all) do
107
107
  Object.send(:remove_const, :OralHistory)
108
108
  end
109
-
110
- it "should be an instance of ActiveFedora::Base" do
111
- @test_history.should be_kind_of(ActiveFedora::Base)
109
+
110
+ it 'should be an instance of ActiveFedora::Base' do
111
+ expect(@test_history).to be_kind_of(ActiveFedora::Base)
112
+ end
113
+
114
+
115
+ it 'should create proxies to all the datastreams' do
116
+ properties_ds = @test_history.datastreams['properties']
117
+ dublin_core_ds = @test_history.datastreams['dublin_core']
118
+ expect(@test_history).not_to respond_to(:properties)
119
+ expect(@test_history.properties).to be properties_ds
120
+ expect(@test_history).to respond_to(:properties)
121
+ expect(OralHistory.new).to respond_to(:properties)
112
122
  end
113
-
114
-
115
- it "should create proxies to all the datastreams" do
116
- properties_ds = @test_history.datastreams["properties"]
117
- dublin_core_ds = @test_history.datastreams["dublin_core"]
118
- @test_history.should_not respond_to(:properties)
119
- @test_history.properties.should be properties_ds
120
- @test_history.should respond_to(:properties)
121
- OralHistory.new.should respond_to(:properties)
122
- end
123
-
124
-
125
- it "should push all of the metadata fields into solr" do
123
+
124
+
125
+ it 'should push all of the metadata fields into solr' do
126
126
  # TODO: test must test values using solr symbol names (ie. _field, _text and _date)
127
- properties_ds = @test_history.datastreams["properties"]
128
- dublin_core_ds = @test_history.datastreams["dublin_core"]
129
-
127
+ properties_ds = @test_history.datastreams['properties']
128
+ dublin_core_ds = @test_history.datastreams['dublin_core']
129
+
130
130
  @properties_sample_values.each_pair do |field, value|
131
131
  next if field == :hard_copy_availability #FIXME HYDRA-824
132
132
  properties_ds.send("#{field.to_s}=", [value])
133
133
  end
134
-
134
+
135
135
  @dublin_core_sample_values.each_pair do |field, value|
136
136
  next if [:format, :type].include?(field) #format and type are methods declared on Object
137
137
  dublin_core_ds.send("#{field.to_s}=", [value])
138
138
  end
139
-
139
+
140
140
  @test_history.save
141
-
142
- @solr_result = OralHistory.find_with_conditions(:id=>@test_history.pid)[0]
141
+
142
+ @solr_result = OralHistory.find_with_conditions(:id => @test_history.pid)[0]
143
143
  @properties_sample_values.each_pair do |field, value|
144
144
  next if field == :hard_copy_availability #FIXME HYDRA-824
145
- next if field == :location #FIXME HYDRA-825
146
- (@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)]).should == [::Solrizer::Extractor.format_node_value(value)]
145
+ next if field == :location #FIXME HYDRA-825
146
+ expect(@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)]).to eq([::Solrizer::Extractor.format_node_value(value)])
147
147
  end
148
-
148
+
149
149
  @dublin_core_sample_values.each_pair do |field, value|
150
150
  next if [:format, :type].include?(field) #format and type are methods declared on Object
151
- dublin_core_ds.send("#{field.to_s}").should == [value]
152
- end
151
+ expect(dublin_core_ds.send("#{field.to_s}")).to eq([value])
152
+ end
153
153
  end
154
-
155
- it "should have Qualified Dublin core, with custom accessors" do
156
-
157
- dublin_core_ds = @test_history.datastreams["dublin_core"]
158
-
159
- dublin_core_ds.subject = "My Subject Heading"
154
+
155
+ it 'should have Qualified Dublin core, with custom accessors' do
156
+
157
+ dublin_core_ds = @test_history.datastreams['dublin_core']
158
+
159
+ dublin_core_ds.subject = 'My Subject Heading'
160
160
  dc_xml = REXML::Document.new(dublin_core_ds.to_xml)
161
-
162
- dc_xml.root.elements["dcterms:subject"].text.should == "My Subject Heading"
163
-
161
+
162
+ expect(dc_xml.root.elements['dcterms:subject'].text).to eq('My Subject Heading')
163
+
164
164
  end
165
-
166
- it "should support #find_with_conditions" do
165
+
166
+ it 'should support #find_with_conditions' do
167
167
  solr_result = OralHistory.find_with_conditions({})
168
- solr_result.should_not be_nil
168
+ expect(solr_result).not_to be_nil
169
169
  end
170
-
170
+
171
171
  describe '#new' do
172
- it "should support custom pids" do
173
- oh = OralHistory.new(:pid=>"uuid:blah-blah-blah")
174
- oh.pid.should == "uuid:blah-blah-blah"
172
+ it 'should support custom pids' do
173
+ oh = OralHistory.new(:pid => 'uuid:blah-blah-blah')
174
+ expect(oh.pid).to eq('uuid:blah-blah-blah')
175
175
  end
176
176
  end
177
-
178
177
 
179
-
178
+
179
+
180
180
  end
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "When two or more relationships share the same property" do
3
+ describe 'When two or more relationships share the same property' do
4
4
  before do
5
- class Book < ActiveFedora::Base
6
- has_many :collections, :class_name=>'Collection'
5
+ class Book < ActiveFedora::Base
6
+ has_many :collections, :class_name => 'Collection'
7
7
  has_many :people
8
8
  end
9
9
 
10
10
  class Person < ActiveFedora::Base
11
- belongs_to :book, :property=>:is_part_of
11
+ belongs_to :book, :property => :is_part_of
12
12
  end
13
13
 
14
14
  class Collection < ActiveFedora::Base
15
- belongs_to :book, :property=>:is_part_of
15
+ belongs_to :book, :property => :is_part_of
16
16
  end
17
17
 
18
18
  @book = Book.create!
19
- @person1 = Person.create!(:book=>@book)
20
- @person2 = Person.create!(:book=>@book)
19
+ @person1 = Person.create!(:book => @book)
20
+ @person2 = Person.create!(:book => @book)
21
21
  end
22
22
  after do
23
23
  Object.send(:remove_const, :Collection)
@@ -25,25 +25,25 @@ describe "When two or more relationships share the same property" do
25
25
  Object.send(:remove_const, :Book)
26
26
  end
27
27
 
28
- it "Should only return relationships of the correct class" do
28
+ it 'Should only return relationships of the correct class' do
29
29
  @book.reload
30
- @book.people.should == [@person1, @person2]
31
- @book.collections.should == []
30
+ expect(@book.people).to eq([@person1, @person2])
31
+ expect(@book.collections).to eq([])
32
32
  end
33
33
  end
34
34
 
35
- describe "When relationship is restricted to AF::Base" do
35
+ describe 'When relationship is restricted to AF::Base' do
36
36
  before do
37
- class Email < ActiveFedora::Base
38
- has_many :attachments, :property=>:is_part_of, :class_name=>'ActiveFedora::Base'
37
+ class Email < ActiveFedora::Base
38
+ has_many :attachments, :property => :is_part_of, :class_name => 'ActiveFedora::Base'
39
39
  end
40
40
 
41
41
  class Image < ActiveFedora::Base
42
- belongs_to :email, :property=>:is_part_of
42
+ belongs_to :email, :property => :is_part_of
43
43
  end
44
44
 
45
45
  class PDF < ActiveFedora::Base
46
- belongs_to :email, :property=>:is_part_of
46
+ belongs_to :email, :property => :is_part_of
47
47
  end
48
48
  end
49
49
 
@@ -54,19 +54,19 @@ describe "When relationship is restricted to AF::Base" do
54
54
  end
55
55
 
56
56
 
57
- describe "creating new objects with object relationships" do
57
+ describe 'creating new objects with object relationships' do
58
58
  before do
59
59
  @book = Email.create!
60
- @image = Image.create!(:email=>@book)
61
- @pdf = PDF.create!(:email=>@book)
60
+ @image = Image.create!(:email => @book)
61
+ @pdf = PDF.create!(:email => @book)
62
62
  end
63
- it "Should not restrict relationships " do
63
+ it 'Should not restrict relationships ' do
64
64
  @book.reload
65
- @book.attachments.should == [@image, @pdf]
65
+ expect(@book.attachments).to eq([@image, @pdf])
66
66
  end
67
67
  end
68
68
 
69
- describe "creating new objects with id setter" do
69
+ describe 'creating new objects with id setter' do
70
70
  let!(:image) { Image.create }
71
71
  let!(:email) { Email.create }
72
72
  let!(:pdf) { PDF.create }
@@ -77,11 +77,11 @@ describe "When relationship is restricted to AF::Base" do
77
77
  image.destroy
78
78
  end
79
79
 
80
- it "Should not restrict relationships " do
81
- Deprecation.should_not_receive(:warn) # a deprecation in 6.6.0 that's going away in 7.0.0
80
+ it 'Should not restrict relationships ' do
81
+ expect(Deprecation).not_to receive(:warn) # a deprecation in 6.6.0 that's going away in 7.0.0
82
82
  email.attachment_ids = [image.id, pdf.id]
83
83
  email.reload
84
- email.attachments.should == [image, pdf]
84
+ expect(email.attachments).to eq([image, pdf])
85
85
  end
86
86
  end
87
87
  end
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Model do
4
-
5
- before(:each) do
4
+
5
+ before(:each) do
6
6
  module ModelIntegrationSpec
7
-
7
+
8
8
  class Base < ActiveFedora::Base
9
9
  include ActiveFedora::Model
10
10
  def self.pid_namespace
11
- "foo"
11
+ 'foo'
12
12
  end
13
- has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream, :autocreate => true
13
+ has_metadata :name => 'properties', :type => ActiveFedora::SimpleDatastream, :autocreate => true
14
14
  end
15
15
  class Basic < Base
16
16
  end
@@ -18,59 +18,59 @@ describe ActiveFedora::Model do
18
18
 
19
19
  @test_instance = ModelIntegrationSpec::Basic.new
20
20
  @test_instance.save
21
-
21
+
22
22
  end
23
-
23
+
24
24
  after(:each) do
25
25
  @test_instance.delete
26
26
  Object.send(:remove_const, :ModelIntegrationSpec)
27
27
  end
28
-
28
+
29
29
  describe '#find' do
30
- describe "with :all" do
31
- it "should return an array of instances of the calling Class" do
30
+ describe 'with :all' do
31
+ it 'should return an array of instances of the calling Class' do
32
32
  result = ModelIntegrationSpec::Basic.find(:all)
33
- result.should be_instance_of(Array)
33
+ expect(result).to be_instance_of(Array)
34
34
  # this test is meaningless if the array length is zero
35
- result.length.should > 0
35
+ expect(result.length).to be > 0
36
36
  result.each do |obj|
37
- obj.class.should == ModelIntegrationSpec::Basic
37
+ expect(obj.class).to eq(ModelIntegrationSpec::Basic)
38
38
  end
39
39
  end
40
40
  end
41
- describe "#find with a valid pid with cast" do
42
- subject { ActiveFedora::Base.find(@test_instance.pid, :cast=>true) }
43
- it { should be_instance_of ModelIntegrationSpec::Basic}
41
+ describe '#find with a valid pid with cast' do
42
+ subject { ActiveFedora::Base.find(@test_instance.pid, :cast => true) }
43
+ it { is_expected.to be_instance_of ModelIntegrationSpec::Basic}
44
44
  end
45
- describe "#find with a valid pid without cast on Base" do
45
+ describe '#find with a valid pid without cast on Base' do
46
46
  subject { ActiveFedora::Base.find(@test_instance.pid) }
47
47
  before(:each) do
48
- Deprecation.should_receive(:warn).at_least(1).times
48
+ expect(Deprecation).to receive(:warn).at_least(1).times
49
49
  end
50
- it { should be_instance_of ActiveFedora::Base}
50
+ it { is_expected.to be_instance_of ActiveFedora::Base}
51
51
  end
52
- describe "#find with a valid pid without cast on a model extending Base" do
52
+ describe '#find with a valid pid without cast on a model extending Base' do
53
53
  subject { ModelIntegrationSpec::Basic.find(@test_instance.pid) }
54
54
  before(:each) do
55
- Deprecation.should_not_receive(:warn)
55
+ expect(Deprecation).not_to receive(:warn)
56
56
  end
57
- it { should be_instance_of ModelIntegrationSpec::Basic}
57
+ it { is_expected.to be_instance_of ModelIntegrationSpec::Basic}
58
58
  end
59
59
  end
60
60
 
61
- describe "#load_instance_from_solr" do
62
- describe "with a valid pid" do
61
+ describe '#load_instance_from_solr' do
62
+ describe 'with a valid pid' do
63
63
  subject { ActiveFedora::Base.load_instance_from_solr(@test_instance.pid) }
64
- it { should be_instance_of ModelIntegrationSpec::Basic}
64
+ it { is_expected.to be_instance_of ModelIntegrationSpec::Basic}
65
65
  end
66
- describe "with metadata datastream spec" do
66
+ describe 'with metadata datastream spec' do
67
67
  subject { ActiveFedora::Base.load_instance_from_solr(@test_instance.pid) }
68
- it "should create an xml datastream" do
69
- subject.datastreams['properties'].should be_kind_of ActiveFedora::SimpleDatastream
68
+ it 'should create an xml datastream' do
69
+ expect(subject.datastreams['properties']).to be_kind_of ActiveFedora::SimpleDatastream
70
70
  end
71
71
 
72
- it "should know the datastreams properties" do
73
- subject.properties.dsSize.should == 9
72
+ it 'should know the datastreams properties' do
73
+ expect(subject.properties.dsSize).to eq(9)
74
74
  end
75
75
  end
76
76
  end