mods 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/spec/title_spec.rb CHANGED
@@ -12,34 +12,34 @@ describe "Mods <titleInfo> element" do
12
12
  it "should recognize type attribute on titleInfo element" do
13
13
  Mods::TitleInfo::TYPES.each { |t|
14
14
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='#{t}'>hi</titleInfo></mods>")
15
- @mods_rec.title_info.type_at.should == [t]
15
+ expect(@mods_rec.title_info.type_at).to eq([t])
16
16
  }
17
17
  end
18
18
  it "should recognize subelements" do
19
19
  Mods::TitleInfo::CHILD_ELEMENTS.each { |e|
20
20
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><#{e}>oofda</#{e}></titleInfo></mods>")
21
- @mods_rec.title_info.send(e).text.should == 'oofda'
21
+ expect(@mods_rec.title_info.send(e).text).to eq('oofda')
22
22
  }
23
23
  end
24
24
 
25
25
  context "short_title" do
26
26
  it "should start with nonSort element" do
27
27
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>")
28
- @mods_rec.title_info.short_title.should == ["The Jerk"]
28
+ expect(@mods_rec.title_info.short_title).to eq(["The Jerk"])
29
29
  end
30
30
  it "should not include subtitle" do
31
31
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>")
32
- @mods_rec.title_info.short_title.should == ["The Jerk"]
32
+ expect(@mods_rec.title_info.short_title).to eq(["The Jerk"])
33
33
  end
34
34
  it "Mods::Record.short_titles convenience method should return an Array (multiple titles are legal in Mods)" do
35
35
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo><titleInfo><title>Joke</title></titleInfo></mods>")
36
- @mods_rec.short_titles.should == ["The Jerk", "Joke"]
36
+ expect(@mods_rec.short_titles).to eq(["The Jerk", "Joke"])
37
37
  end
38
38
  it "should not include alternative titles" do
39
39
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>ta da!</title></titleInfo></mods>")
40
- @mods_rec.short_titles.should_not include("ta da!")
40
+ expect(@mods_rec.short_titles).not_to include("ta da!")
41
41
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo><title>2</title></titleInfo></mods>")
42
- @mods_rec.short_titles.should == ['2']
42
+ expect(@mods_rec.short_titles).to eq(['2'])
43
43
  end
44
44
  # note that Mods::Record.short_title tests are in record_spec
45
45
  end
@@ -47,15 +47,15 @@ describe "Mods <titleInfo> element" do
47
47
  context "full_title" do
48
48
  it "should start with nonSort element" do
49
49
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>")
50
- @mods_rec.title_info.full_title.should == ["The Jerk"]
50
+ expect(@mods_rec.title_info.full_title).to eq(["The Jerk"])
51
51
  end
52
52
  it "should include subtitle" do
53
53
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>")
54
- @mods_rec.title_info.full_title.should == ["The Jerk A Tale of Tourettes"]
54
+ expect(@mods_rec.title_info.full_title).to eq(["The Jerk A Tale of Tourettes"])
55
55
  end
56
56
  it "Mods::Record.full_titles convenience method should return an Array (multiple titles are legal in Mods)" do
57
57
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo><titleInfo><title>Joke</title></titleInfo></mods>")
58
- @mods_rec.full_titles.should == ["The Jerk", "Joke"]
58
+ expect(@mods_rec.full_titles).to eq(["The Jerk", "Joke"])
59
59
  end
60
60
  # note that Mods::Record.full_title tests are in record_spec
61
61
  end
@@ -63,30 +63,30 @@ describe "Mods <titleInfo> element" do
63
63
  context "sort_title" do
64
64
  it "should skip nonSort element" do
65
65
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>")
66
- @mods_rec.title_info.sort_title.should == ["Jerk"]
66
+ expect(@mods_rec.title_info.sort_title).to eq(["Jerk"])
67
67
  end
68
68
  it "should contain title and subtitle" do
69
69
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>")
70
- @mods_rec.title_info.sort_title.should == ["Jerk A Tale of Tourettes"]
70
+ expect(@mods_rec.title_info.sort_title).to eq(["Jerk A Tale of Tourettes"])
71
71
  end
72
72
  it "should be an alternative title if there are no other choices" do
73
73
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>1</title></titleInfo></mods>")
74
- @mods_rec.title_info.sort_title.should == ['1']
74
+ expect(@mods_rec.title_info.sort_title).to eq(['1'])
75
75
  end
76
76
  it "should not be an alternative title if there are other choices" do
77
77
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo><title>2</title></titleInfo></mods>")
78
- @mods_rec.title_info.sort_title.should == ['2']
79
- @mods_rec.sort_title.should == '2'
78
+ expect(@mods_rec.title_info.sort_title).to eq(['2'])
79
+ expect(@mods_rec.sort_title).to eq('2')
80
80
  end
81
81
  it "should have a configurable delimiter between title and subtitle" do
82
82
  m = Mods::Record.new(' : ')
83
83
  m.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>")
84
- m.title_info.sort_title.should == ["Jerk : A Tale of Tourettes"]
84
+ expect(m.title_info.sort_title).to eq(["Jerk : A Tale of Tourettes"])
85
85
  end
86
86
  context "Mods::Record.sort_title convenience method" do
87
87
  it "convenience method sort_title in Mods::Record should return a string" do
88
88
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>")
89
- @mods_rec.sort_title.should == "Jerk A Tale of Tourettes"
89
+ expect(@mods_rec.sort_title).to eq("Jerk A Tale of Tourettes")
90
90
  end
91
91
  end
92
92
  # note that Mods::Record.sort_title tests are in record_spec
@@ -95,21 +95,21 @@ describe "Mods <titleInfo> element" do
95
95
  context "alternative_title" do
96
96
  it "should get an alternative title, if it exists" do
97
97
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>ta da!</title></titleInfo></mods>")
98
- @mods_rec.title_info.alternative_title.should == ["ta da!"]
98
+ expect(@mods_rec.title_info.alternative_title).to eq(["ta da!"])
99
99
  end
100
100
  it "Mods::Record.alternative_titles convenience method for getting an Array of alternative titles when there are multiple elements" do
101
101
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo type='alternative'><title>2</title></titleInfo></mods>")
102
- @mods_rec.alternative_titles.should == ['1', '2']
102
+ expect(@mods_rec.alternative_titles).to eq(['1', '2'])
103
103
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='alternative'><title>1</title><title>2</title></titleInfo></mods>")
104
- @mods_rec.alternative_titles.should == ['12']
104
+ expect(@mods_rec.alternative_titles).to eq(['12'])
105
105
  end
106
106
  it "should not get an alternative title if type attribute is absent from titleInfo" do
107
107
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo><title>ta da!</title></titleInfo></mods>")
108
- @mods_rec.alternative_titles.should == []
108
+ expect(@mods_rec.alternative_titles).to eq([])
109
109
  end
110
110
  it "should not get an alternative title if type attribute from titleInfo is not 'alternative'" do
111
111
  @mods_rec.from_str("<mods #{@ns_decl}><titleInfo type='uniform'><title>ta da!</title></titleInfo></mods>")
112
- @mods_rec.alternative_titles.should == []
112
+ expect(@mods_rec.alternative_titles).to eq([])
113
113
  end
114
114
  # note that Mods::Record.alternative_title tests are in record_spec
115
115
  end
@@ -120,34 +120,34 @@ describe "Mods <titleInfo> element" do
120
120
  it "should recognize type attribute on titleInfo element" do
121
121
  Mods::TitleInfo::TYPES.each { |t|
122
122
  @mods_rec.from_str("<mods><titleInfo type='#{t}'>hi</titleInfo></mods>", false)
123
- @mods_rec.title_info.type_at.should == [t]
123
+ expect(@mods_rec.title_info.type_at).to eq([t])
124
124
  }
125
125
  end
126
126
  it "should recognize subelements" do
127
127
  Mods::TitleInfo::CHILD_ELEMENTS.each { |e|
128
128
  @mods_rec.from_str("<mods><titleInfo><#{e}>oofda</#{e}></titleInfo></mods>", false)
129
- @mods_rec.title_info.send(e).text.should == 'oofda'
129
+ expect(@mods_rec.title_info.send(e).text).to eq('oofda')
130
130
  }
131
131
  end
132
132
 
133
133
  context "short_title" do
134
134
  it "should start with nonSort element" do
135
135
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>", false)
136
- @mods_rec.title_info.short_title.should == ["The Jerk"]
136
+ expect(@mods_rec.title_info.short_title).to eq(["The Jerk"])
137
137
  end
138
138
  it "should not include subtitle" do
139
139
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>", false)
140
- @mods_rec.title_info.short_title.should == ["The Jerk"]
140
+ expect(@mods_rec.title_info.short_title).to eq(["The Jerk"])
141
141
  end
142
142
  it "Mods::Record.short_titles convenience method should return an Array (multiple titles are legal in Mods)" do
143
143
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo><titleInfo><title>Joke</title></titleInfo></mods>", false)
144
- @mods_rec.short_titles.should == ["The Jerk", "Joke"]
144
+ expect(@mods_rec.short_titles).to eq(["The Jerk", "Joke"])
145
145
  end
146
146
  it "should not include alternative titles" do
147
147
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>ta da!</title></titleInfo></mods>", false)
148
- @mods_rec.short_titles.should_not include("ta da!")
148
+ expect(@mods_rec.short_titles).not_to include("ta da!")
149
149
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo><title>2</title></titleInfo></mods>", false)
150
- @mods_rec.short_titles.should == ['2']
150
+ expect(@mods_rec.short_titles).to eq(['2'])
151
151
  end
152
152
  # note that Mods::Record.short_title tests are in record_spec
153
153
  end
@@ -155,15 +155,15 @@ describe "Mods <titleInfo> element" do
155
155
  context "full_title" do
156
156
  it "should start with nonSort element" do
157
157
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>", false)
158
- @mods_rec.title_info.full_title.should == ["The Jerk"]
158
+ expect(@mods_rec.title_info.full_title).to eq(["The Jerk"])
159
159
  end
160
160
  it "should include subtitle" do
161
161
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>", false)
162
- @mods_rec.title_info.full_title.should == ["The Jerk A Tale of Tourettes"]
162
+ expect(@mods_rec.title_info.full_title).to eq(["The Jerk A Tale of Tourettes"])
163
163
  end
164
164
  it "Mods::Record.full_titles convenience method should return an Array (multiple titles are legal in Mods)" do
165
165
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo><titleInfo><title>Joke</title></titleInfo></mods>", false)
166
- @mods_rec.full_titles.should == ["The Jerk", "Joke"]
166
+ expect(@mods_rec.full_titles).to eq(["The Jerk", "Joke"])
167
167
  end
168
168
  # note that Mods::Record.full_title tests are in record_spec
169
169
  end
@@ -171,30 +171,30 @@ describe "Mods <titleInfo> element" do
171
171
  context "sort_title" do
172
172
  it "should skip nonSort element" do
173
173
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><nonSort>The</nonSort></titleInfo></mods>", false)
174
- @mods_rec.title_info.sort_title.should == ["Jerk"]
174
+ expect(@mods_rec.title_info.sort_title).to eq(["Jerk"])
175
175
  end
176
176
  it "should contain title and subtitle" do
177
177
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>", false)
178
- @mods_rec.title_info.sort_title.should == ["Jerk A Tale of Tourettes"]
178
+ expect(@mods_rec.title_info.sort_title).to eq(["Jerk A Tale of Tourettes"])
179
179
  end
180
180
  it "should be an alternative title if there are no other choices" do
181
181
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>1</title></titleInfo></mods>", false)
182
- @mods_rec.title_info.sort_title.should == ['1']
182
+ expect(@mods_rec.title_info.sort_title).to eq(['1'])
183
183
  end
184
184
  it "should not be an alternative title if there are other choices" do
185
185
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo><title>2</title></titleInfo></mods>", false)
186
- @mods_rec.title_info.sort_title.should == ['2']
187
- @mods_rec.sort_title.should == '2'
186
+ expect(@mods_rec.title_info.sort_title).to eq(['2'])
187
+ expect(@mods_rec.sort_title).to eq('2')
188
188
  end
189
189
  it "should have a configurable delimiter between title and subtitle" do
190
190
  m = Mods::Record.new(' : ')
191
191
  m.from_str("<mods><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>", false)
192
- m.title_info.sort_title.should == ["Jerk : A Tale of Tourettes"]
192
+ expect(m.title_info.sort_title).to eq(["Jerk : A Tale of Tourettes"])
193
193
  end
194
194
  context "Mods::Record.sort_title convenience method" do
195
195
  it "convenience method sort_title in Mods::Record should return a string" do
196
196
  @mods_rec.from_str("<mods><titleInfo><title>Jerk</title><subTitle>A Tale of Tourettes</subTitle><nonSort>The</nonSort></titleInfo></mods>", false)
197
- @mods_rec.sort_title.should == "Jerk A Tale of Tourettes"
197
+ expect(@mods_rec.sort_title).to eq("Jerk A Tale of Tourettes")
198
198
  end
199
199
  end
200
200
  # note that Mods::Record.sort_title tests are in record_spec
@@ -203,21 +203,21 @@ describe "Mods <titleInfo> element" do
203
203
  context "alternative_title" do
204
204
  it "should get an alternative title, if it exists" do
205
205
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>ta da!</title></titleInfo></mods>", false)
206
- @mods_rec.title_info.alternative_title.should == ["ta da!"]
206
+ expect(@mods_rec.title_info.alternative_title).to eq(["ta da!"])
207
207
  end
208
208
  it "Mods::Record.alternative_titles convenience method for getting an Array of alternative titles when there are multiple elements" do
209
209
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>1</title></titleInfo><titleInfo type='alternative'><title>2</title></titleInfo></mods>", false)
210
- @mods_rec.alternative_titles.should == ['1', '2']
210
+ expect(@mods_rec.alternative_titles).to eq(['1', '2'])
211
211
  @mods_rec.from_str("<mods><titleInfo type='alternative'><title>1</title><title>2</title></titleInfo></mods>", false)
212
- @mods_rec.alternative_titles.should == ['12']
212
+ expect(@mods_rec.alternative_titles).to eq(['12'])
213
213
  end
214
214
  it "should not get an alternative title if type attribute is absent from titleInfo" do
215
215
  @mods_rec.from_str("<mods><titleInfo><title>ta da!</title></titleInfo></mods>", false)
216
- @mods_rec.alternative_titles.should == []
216
+ expect(@mods_rec.alternative_titles).to eq([])
217
217
  end
218
218
  it "should not get an alternative title if type attribute from titleInfo is not 'alternative'" do
219
219
  @mods_rec.from_str("<mods><titleInfo type='uniform'><title>ta da!</title></titleInfo></mods>", false)
220
- @mods_rec.alternative_titles.should == []
220
+ expect(@mods_rec.alternative_titles).to eq([])
221
221
  end
222
222
  # note that Mods::Record.alternative_title tests are in record_spec
223
223
  end
@@ -14,7 +14,7 @@ describe "Mods Top Level Elements that do not have Child Elements" do
14
14
  skip "to be implemented"
15
15
  Mods::TOP_LEVEL_ELEMENTS_COMPLEX.each { |elname|
16
16
  @mods_rec.from_str("<mods><#{elname}>hi</#{elname}></mods>", false)
17
- @mods_rec.send(elname.to_sym).map { |e| e.text }.should == ["hi"]
17
+ expect(@mods_rec.send(elname.to_sym).map { |e| e.text }).to eq(["hi"])
18
18
  }
19
19
  end
20
20
 
@@ -23,22 +23,22 @@ describe "Mods Top Level Elements that do not have Child Elements" do
23
23
  it "should get the text contents of any single simple (cannot have child elements) top level element" do
24
24
  Mods::TOP_LEVEL_ELEMENTS_SIMPLE.each { |elname|
25
25
  @mods_rec.from_str("<mods><#{elname}>hi</#{elname}></mods>", false)
26
- @mods_rec.send(elname.to_sym).map { |e| e.text }.should == ["hi"]
26
+ expect(@mods_rec.send(elname.to_sym).map { |e| e.text }).to eq(["hi"])
27
27
  }
28
28
  end
29
29
 
30
30
  it "should return an array of strings when there are multiple occurrences of simple top level elements" do
31
- @mods_rec.from_str('<mods><note>hi</note><note>hello</note></mods>', false).note.map { |e| e.text }.should == ["hi", "hello"]
31
+ expect(@mods_rec.from_str('<mods><note>hi</note><note>hello</note></mods>', false).note.map { |e| e.text }).to eq(["hi", "hello"])
32
32
  end
33
33
 
34
34
  context "<abstract> child element" do
35
35
  it ".abstract.displayLabel should be an accessor for displayLabel attribute on abstract element: <abstract displayLabel='foo'>" do
36
36
  @mods_rec.from_str('<mods><abstract displayLabel="Summary">blah blah blah</abstract></mods>', false)
37
- @mods_rec.abstract.displayLabel.should == ['Summary']
37
+ expect(@mods_rec.abstract.displayLabel).to eq(['Summary'])
38
38
  end
39
39
  it ".abstract.type_at should be an accessor for type attribute on abstract element: <abstract type='foo'>" do
40
40
  @mods_rec.from_str('<mods><abstract type="Scope and Contents note">blah blah blah</abstract></mods>', false)
41
- @mods_rec.abstract.type_at.should == ['Scope and Contents note']
41
+ expect(@mods_rec.abstract.type_at).to eq(['Scope and Contents note'])
42
42
  end
43
43
  end
44
44
 
@@ -48,10 +48,10 @@ describe "Mods Top Level Elements that do not have Child Elements" do
48
48
  @acc_cond2 = @mods_rec.from_str('<mods><accessCondition type="useAndReproduction">All rights reserved.</accessCondition></mods>', false).accessCondition
49
49
  end
50
50
  it ".accessCondition.displayLabel should be an accessor for displayLabel attribute on accessCondition element: <accessCondition displayLabel='foo'>" do
51
- @acc_cond.displayLabel.should == ['meh']
51
+ expect(@acc_cond.displayLabel).to eq(['meh'])
52
52
  end
53
53
  it ".accessCondition.type_at should be an accessor for type attribute on accessCondition element: <accessCondition type='foo'>" do
54
- [@acc_cond, @acc_cond2].each { |ac| ac.type_at.should == ['useAndReproduction'] }
54
+ [@acc_cond, @acc_cond2].each { |ac| expect(ac.type_at).to eq(['useAndReproduction']) }
55
55
  end
56
56
  end
57
57
 
@@ -61,16 +61,16 @@ describe "Mods Top Level Elements that do not have Child Elements" do
61
61
  @class2 = @mods_rec.from_str('<mods><classification authority="lcc">JK609.M2</classification></mods>', false).classification
62
62
  end
63
63
  it ".classification.authority should be an accessor for authority attribute on classification element: <classification authority='foo'>" do
64
- @class1.authority.should == ['ddc']
65
- @class2.authority.should == ['lcc']
64
+ expect(@class1.authority).to eq(['ddc'])
65
+ expect(@class2.authority).to eq(['lcc'])
66
66
  end
67
67
  it ".classification.edition should be an accessor for edition attribute on classification element: <classification edition='foo'>" do
68
- @class1.edition.should == ['11']
68
+ expect(@class1.edition).to eq(['11'])
69
69
  end
70
70
  it "should recognize all authority attributes" do
71
71
  Mods::AUTHORITY_ATTRIBS.each { |a|
72
72
  @mods_rec.from_str("<mods><classification #{a}='attr_val'>zzz</classification></mods>", false)
73
- @mods_rec.classification.send(a.to_sym).should == ['attr_val']
73
+ expect(@mods_rec.classification.send(a.to_sym)).to eq(['attr_val'])
74
74
  }
75
75
  end
76
76
  end
@@ -83,27 +83,27 @@ describe "Mods Top Level Elements that do not have Child Elements" do
83
83
  end
84
84
  it ".extension.displayLabel should be an accessor for displayLabel attribute on extension element: <extension displayLabel='foo'>" do
85
85
  @mods_rec.from_str('<mods><extension displayLabel="something">blah blah blah</extension></mods>', false)
86
- @mods_rec.extension.displayLabel.should == ['something']
86
+ expect(@mods_rec.extension.displayLabel).to eq(['something'])
87
87
  end
88
88
  end
89
89
 
90
90
  context "<genre> child element" do
91
91
  it ".genre.displayLabel should be an accessor for displayLabel attribute on genre element: <genre displayLabel='foo'>" do
92
92
  @mods_rec.from_str('<mods><genre displayLabel="something">blah blah blah</genre></mods>', false)
93
- @mods_rec.genre.displayLabel.should == ['something']
93
+ expect(@mods_rec.genre.displayLabel).to eq(['something'])
94
94
  end
95
95
  it ".genre.type_at should be an accessor for type attribute on genre element: <genre type='foo'>" do
96
96
  @mods_rec.from_str('<mods><genre type="maybe">blah blah blah</genre></mods>', false)
97
- @mods_rec.genre.type_at.should == ['maybe']
97
+ expect(@mods_rec.genre.type_at).to eq(['maybe'])
98
98
  end
99
99
  it ".genre.usage should be an accessor for usage attribute on genre element: <genre usage='foo'>" do
100
100
  @mods_rec.from_str('<mods><genre usage="fer sure">blah blah blah</genre></mods>', false)
101
- @mods_rec.genre.usage.should == ['fer sure']
101
+ expect(@mods_rec.genre.usage).to eq(['fer sure'])
102
102
  end
103
103
  it "should recognize all authority attributes" do
104
104
  Mods::AUTHORITY_ATTRIBS.each { |a|
105
105
  @mods_rec.from_str("<mods><genre #{a}='attr_val'>zzz</genre></mods>", false)
106
- @mods_rec.genre.send(a.to_sym).should == ['attr_val']
106
+ expect(@mods_rec.genre.send(a.to_sym)).to eq(['attr_val'])
107
107
  }
108
108
  end
109
109
  end
@@ -113,56 +113,56 @@ describe "Mods Top Level Elements that do not have Child Elements" do
113
113
  @id = @mods_rec.from_str('<mods><identifier displayLabel="book_number" type="local">70</identifier></mods>', false).identifier
114
114
  end
115
115
  it ".identifier.displayLabel should be an accessor for displayLabel attribute on identifier element: <identifier displayLabel='foo'>" do
116
- @id.displayLabel.should == ['book_number']
116
+ expect(@id.displayLabel).to eq(['book_number'])
117
117
  end
118
118
  it ".identifier.invalid should be an accessor for invalid attribute on identifier element: <identifier invalid='foo'>" do
119
119
  @mods_rec.from_str('<mods> <identifier type="isbn" invalid="yes">0877780116</identifier></mods>', false)
120
- @mods_rec.identifier.invalid.should == ['yes']
120
+ expect(@mods_rec.identifier.invalid).to eq(['yes'])
121
121
  end
122
122
  it ".identifier.type_at should be an accessor for type attribute on identifier element: <identifier type='foo'>" do
123
- @id.type_at.should == ['local']
123
+ expect(@id.type_at).to eq(['local'])
124
124
  end
125
125
  end
126
126
 
127
127
  context "<note> child element" do
128
128
  it ".note.displayLabel should be an accessor for displayLabel attribute on note element: <note displayLabel='foo'>" do
129
129
  @mods_rec.from_str('<mods><note displayLabel="state_note">blah</note></mods>', false)
130
- @mods_rec.note.displayLabel.should == ['state_note']
130
+ expect(@mods_rec.note.displayLabel).to eq(['state_note'])
131
131
  end
132
132
  it ".note.id_at should be an accessor for ID attribute on note element: <note ID='foo'>" do
133
133
  @mods_rec.from_str('<mods><note ID="foo">blah blah blah</note></mods>', false)
134
- @mods_rec.note.id_at.should == ['foo']
134
+ expect(@mods_rec.note.id_at).to eq(['foo'])
135
135
  end
136
136
  it ".note.type_at should be an accessor for type attribute on note element: <note type='foo'>" do
137
137
  @mods_rec.from_str('<mods><note type="content">blah</note></mods>', false)
138
- @mods_rec.note.type_at.should == ['content']
138
+ expect(@mods_rec.note.type_at).to eq(['content'])
139
139
  end
140
140
  end
141
141
 
142
142
  context "<tableOfContents> child element" do
143
143
  it ".tableOfContents.displayLabel should be an accessor for displayLabel attribute on tableOfContents element: <tableOfContents displayLabel='foo'>" do
144
144
  @mods_rec.from_str('<mods><tableOfContents displayLabel="Chapters included in book">blah blah</tableOfContents></mods>', false)
145
- @mods_rec.tableOfContents.displayLabel.should == ['Chapters included in book']
145
+ expect(@mods_rec.tableOfContents.displayLabel).to eq(['Chapters included in book'])
146
146
  end
147
147
  it ".tableOfContents.shareable should be an accessor for shareable attribute on tableOfContents element: <tableOfContents shareable='foo'>" do
148
148
  @mods_rec.from_str('<mods><tableOfContents shareable="no">blah blah blah</tableOfContents></mods>', false)
149
- @mods_rec.tableOfContents.shareable.should == ['no']
149
+ expect(@mods_rec.tableOfContents.shareable).to eq(['no'])
150
150
  end
151
151
  it ".tableOfContents.type_at should be an accessor for type attribute on tableOfContents element: <tableOfContents type='foo'>" do
152
152
  @mods_rec.from_str('<mods><tableOfContents type="partial contents">blah blah</tableOfContents></mods>', false)
153
- @mods_rec.tableOfContents.type_at.should == ['partial contents']
153
+ expect(@mods_rec.tableOfContents.type_at).to eq(['partial contents'])
154
154
  end
155
155
  end
156
156
 
157
157
  context "<targetAudience> child element" do
158
158
  it ".targetAudience.displayLabel should be an accessor for displayLabel attribute on targetAudience element: <targetAudience displayLabel='foo'>" do
159
159
  @mods_rec.from_str('<mods><targetAudience displayLabel="ta da">blah blah</targetAudience></mods>', false)
160
- @mods_rec.targetAudience.displayLabel.should == ['ta da']
160
+ expect(@mods_rec.targetAudience.displayLabel).to eq(['ta da'])
161
161
  end
162
162
  it "should recognize all authority attributes" do
163
163
  Mods::AUTHORITY_ATTRIBS.each { |a|
164
164
  @mods_rec.from_str("<mods><targetAudience #{a}='attr_val'>zzz</targetAudience></mods>", false)
165
- @mods_rec.targetAudience.send(a.to_sym).should == ['attr_val']
165
+ expect(@mods_rec.targetAudience.send(a.to_sym)).to eq(['attr_val'])
166
166
  }
167
167
  end
168
168
  end
@@ -173,19 +173,19 @@ describe "Mods Top Level Elements that do not have Child Elements" do
173
173
  end
174
174
  it ".typeOfResource.collection should be an accessor for collection attribute on typeOfResource element: <typeOfResource collection='foo'>" do
175
175
  @mods_rec.from_str('<mods><typeOfResource collection="yes">blah blah blah</typeOfResource></mods>', false)
176
- @mods_rec.typeOfResource.collection.should == ['yes']
176
+ expect(@mods_rec.typeOfResource.collection).to eq(['yes'])
177
177
  end
178
178
  it ".typeOfResource.displayLabel should be an accessor for displayLabel attribute on typeOfResource element: <typeOfResource displayLabel='foo'>" do
179
179
  @mods_rec.from_str('<mods><typeOfResource displayLabel="Summary">blah blah blah</typeOfResource></mods>', false)
180
- @mods_rec.typeOfResource.displayLabel.should == ['Summary']
180
+ expect(@mods_rec.typeOfResource.displayLabel).to eq(['Summary'])
181
181
  end
182
182
  it ".typeOfResource.manuscript should be an accessor for manuscript attribute on typeOfResource element: <typeOfResource manuscript='foo'>" do
183
183
  @mods_rec.from_str('<mods><typeOfResource manuscript="yes">blah blah blah</typeOfResource></mods>', false)
184
- @mods_rec.typeOfResource.manuscript.should == ['yes']
184
+ expect(@mods_rec.typeOfResource.manuscript).to eq(['yes'])
185
185
  end
186
186
  it ".typeOfResource.usage should be an accessor for usage attribute on typeOfResource element: <typeOfResource usage='foo'>" do
187
187
  @mods_rec.from_str('<mods><typeOfResource usage="fer sure">blah blah blah</typeOfResource></mods>', false)
188
- @mods_rec.typeOfResource.usage.should == ['fer sure']
188
+ expect(@mods_rec.typeOfResource.usage).to eq(['fer sure'])
189
189
  end
190
190
  end
191
191
 
@@ -200,22 +200,22 @@ describe "Mods Top Level Elements that do not have Child Elements" do
200
200
  it "should get the text contents of any single simple (cannot have child elements) top level element" do
201
201
  Mods::TOP_LEVEL_ELEMENTS_SIMPLE.each { |elname|
202
202
  @mods_rec.from_str(@mods_el_w_ns + "<#{elname}>hi</#{elname}></mods>")
203
- @mods_rec.send(elname.to_sym).map { |e| e.text }.should == ["hi"]
203
+ expect(@mods_rec.send(elname.to_sym).map { |e| e.text }).to eq(["hi"])
204
204
  }
205
205
  end
206
206
 
207
207
  it "should return an array of strings when there are multiple occurrences of simple top level elements" do
208
- @mods_rec.from_str(@mods_el_w_ns + '<note>hi</note><note>hello</note></mods>').note.map { |e| e.text }.should == ["hi", "hello"]
208
+ expect(@mods_rec.from_str(@mods_el_w_ns + '<note>hi</note><note>hello</note></mods>').note.map { |e| e.text }).to eq(["hi", "hello"])
209
209
  end
210
210
 
211
211
  context "<abstract> child element" do
212
212
  it ".abstract.displayLabel should be an accessor for displayLabel attribute on abstract element: <abstract displayLabel='foo'>" do
213
213
  @mods_rec.from_str(@mods_el_w_ns + '<abstract displayLabel="Summary">blah blah blah</abstract></mods>')
214
- @mods_rec.abstract.displayLabel.should == ['Summary']
214
+ expect(@mods_rec.abstract.displayLabel).to eq(['Summary'])
215
215
  end
216
216
  it ".abstract.type_at should be an accessor for type attribute on abstract element: <abstract type='foo'>" do
217
217
  @mods_rec.from_str(@mods_el_w_ns + '<abstract type="Scope and Contents note">blah blah blah</abstract></mods>')
218
- @mods_rec.abstract.type_at.should == ['Scope and Contents note']
218
+ expect(@mods_rec.abstract.type_at).to eq(['Scope and Contents note'])
219
219
  end
220
220
  end
221
221
 
@@ -225,10 +225,10 @@ describe "Mods Top Level Elements that do not have Child Elements" do
225
225
  @acc_cond2 = @mods_rec.from_str(@mods_el_w_ns + '<accessCondition type="useAndReproduction">All rights reserved.</accessCondition></mods>').accessCondition
226
226
  end
227
227
  it ".accessCondition.displayLabel should be an accessor for displayLabel attribute on accessCondition element: <accessCondition displayLabel='foo'>" do
228
- @acc_cond.displayLabel.should == ['meh']
228
+ expect(@acc_cond.displayLabel).to eq(['meh'])
229
229
  end
230
230
  it ".accessCondition.type_at should be an accessor for type attribute on accessCondition element: <accessCondition type='foo'>" do
231
- [@acc_cond, @acc_cond2].each { |ac| ac.type_at.should == ['useAndReproduction'] }
231
+ [@acc_cond, @acc_cond2].each { |ac| expect(ac.type_at).to eq(['useAndReproduction']) }
232
232
  end
233
233
  end
234
234
 
@@ -238,16 +238,16 @@ describe "Mods Top Level Elements that do not have Child Elements" do
238
238
  @class2 = @mods_rec.from_str(@mods_el_w_ns + '<classification authority="lcc">JK609.M2</classification></mods>').classification
239
239
  end
240
240
  it ".classification.authority should be an accessor for authority attribute on classification element: <classification authority='foo'>" do
241
- @class1.authority.should == ['ddc']
242
- @class2.authority.should == ['lcc']
241
+ expect(@class1.authority).to eq(['ddc'])
242
+ expect(@class2.authority).to eq(['lcc'])
243
243
  end
244
244
  it ".classification.edition should be an accessor for edition attribute on classification element: <classification edition='foo'>" do
245
- @class1.edition.should == ['11']
245
+ expect(@class1.edition).to eq(['11'])
246
246
  end
247
247
  it "should recognize all authority attributes" do
248
248
  Mods::AUTHORITY_ATTRIBS.each { |a|
249
249
  @mods_rec.from_str(@mods_el_w_ns + "<classification #{a}='attr_val'>zzz</classification></mods>")
250
- @mods_rec.classification.send(a.to_sym).should == ['attr_val']
250
+ expect(@mods_rec.classification.send(a.to_sym)).to eq(['attr_val'])
251
251
  }
252
252
  end
253
253
  end
@@ -260,27 +260,27 @@ describe "Mods Top Level Elements that do not have Child Elements" do
260
260
  end
261
261
  it ".extension.displayLabel should be an accessor for displayLabel attribute on extension element: <extension displayLabel='foo'>" do
262
262
  @mods_rec.from_str(@mods_el_w_ns + '<extension displayLabel="something">blah blah blah</extension></mods>')
263
- @mods_rec.extension.displayLabel.should == ['something']
263
+ expect(@mods_rec.extension.displayLabel).to eq(['something'])
264
264
  end
265
265
  end
266
266
 
267
267
  context "<genre> child element" do
268
268
  it ".genre.displayLabel should be an accessor for displayLabel attribute on genre element: <genre displayLabel='foo'>" do
269
269
  @mods_rec.from_str(@mods_el_w_ns + '<genre displayLabel="something">blah blah blah</genre></mods>')
270
- @mods_rec.genre.displayLabel.should == ['something']
270
+ expect(@mods_rec.genre.displayLabel).to eq(['something'])
271
271
  end
272
272
  it ".genre.type_at should be an accessor for type attribute on genre element: <genre type='foo'>" do
273
273
  @mods_rec.from_str(@mods_el_w_ns + '<genre type="maybe">blah blah blah</genre></mods>')
274
- @mods_rec.genre.type_at.should == ['maybe']
274
+ expect(@mods_rec.genre.type_at).to eq(['maybe'])
275
275
  end
276
276
  it ".genre.usage should be an accessor for usage attribute on genre element: <genre usage='foo'>" do
277
277
  @mods_rec.from_str(@mods_el_w_ns + '<genre usage="fer sure">blah blah blah</genre></mods>')
278
- @mods_rec.genre.usage.should == ['fer sure']
278
+ expect(@mods_rec.genre.usage).to eq(['fer sure'])
279
279
  end
280
280
  it "should recognize all authority attributes" do
281
281
  Mods::AUTHORITY_ATTRIBS.each { |a|
282
282
  @mods_rec.from_str(@mods_el_w_ns + "<genre #{a}='attr_val'>zzz</genre></mods>")
283
- @mods_rec.genre.send(a.to_sym).should == ['attr_val']
283
+ expect(@mods_rec.genre.send(a.to_sym)).to eq(['attr_val'])
284
284
  }
285
285
  end
286
286
  end
@@ -290,56 +290,56 @@ describe "Mods Top Level Elements that do not have Child Elements" do
290
290
  @id = @mods_rec.from_str(@mods_el_w_ns + '<identifier displayLabel="book_number" type="local">70</identifier></mods>').identifier
291
291
  end
292
292
  it ".identifier.displayLabel should be an accessor for displayLabel attribute on identifier element: <identifier displayLabel='foo'>" do
293
- @id.displayLabel.should == ['book_number']
293
+ expect(@id.displayLabel).to eq(['book_number'])
294
294
  end
295
295
  it ".identifier.invalid should be an accessor for invalid attribute on identifier element: <identifier invalid='foo'>" do
296
296
  @mods_rec.from_str(@mods_el_w_ns + '<identifier type="isbn" invalid="yes">0877780116</identifier></mods>')
297
- @mods_rec.identifier.invalid.should == ['yes']
297
+ expect(@mods_rec.identifier.invalid).to eq(['yes'])
298
298
  end
299
299
  it ".identifier.type_at should be an accessor for type attribute on identifier element: <identifier type='foo'>" do
300
- @id.type_at.should == ['local']
300
+ expect(@id.type_at).to eq(['local'])
301
301
  end
302
302
  end
303
303
 
304
304
  context "<note> child element" do
305
305
  it ".note.displayLabel should be an accessor for displayLabel attribute on note element: <note displayLabel='foo'>" do
306
306
  @mods_rec.from_str(@mods_el_w_ns + '<note displayLabel="state_note">blah</note></mods>')
307
- @mods_rec.note.displayLabel.should == ['state_note']
307
+ expect(@mods_rec.note.displayLabel).to eq(['state_note'])
308
308
  end
309
309
  it ".note.id_at should be an accessor for ID attribute on note element: <note ID='foo'>" do
310
310
  @mods_rec.from_str(@mods_el_w_ns + '<note ID="foo">blah blah blah</note></mods>')
311
- @mods_rec.note.id_at.should == ['foo']
311
+ expect(@mods_rec.note.id_at).to eq(['foo'])
312
312
  end
313
313
  it ".note.type_at should be an accessor for type attribute on note element: <note type='foo'>" do
314
314
  @mods_rec.from_str(@mods_el_w_ns + '<note type="content">blah</note></mods>')
315
- @mods_rec.note.type_at.should == ['content']
315
+ expect(@mods_rec.note.type_at).to eq(['content'])
316
316
  end
317
317
  end
318
318
 
319
319
  context "<tableOfContents> child element" do
320
320
  it ".tableOfContents.displayLabel should be an accessor for displayLabel attribute on tableOfContents element: <tableOfContents displayLabel='foo'>" do
321
321
  @mods_rec.from_str(@mods_el_w_ns + '<tableOfContents displayLabel="Chapters included in book">blah blah</tableOfContents></mods>')
322
- @mods_rec.tableOfContents.displayLabel.should == ['Chapters included in book']
322
+ expect(@mods_rec.tableOfContents.displayLabel).to eq(['Chapters included in book'])
323
323
  end
324
324
  it ".tableOfContents.shareable should be an accessor for shareable attribute on tableOfContents element: <tableOfContents shareable='foo'>" do
325
325
  @mods_rec.from_str(@mods_el_w_ns + '<tableOfContents shareable="no">blah blah blah</tableOfContents></mods>')
326
- @mods_rec.tableOfContents.shareable.should == ['no']
326
+ expect(@mods_rec.tableOfContents.shareable).to eq(['no'])
327
327
  end
328
328
  it ".tableOfContents.type_at should be an accessor for type attribute on tableOfContents element: <tableOfContents type='foo'>" do
329
329
  @mods_rec.from_str(@mods_el_w_ns + '<tableOfContents type="partial contents">blah blah</tableOfContents></mods>')
330
- @mods_rec.tableOfContents.type_at.should == ['partial contents']
330
+ expect(@mods_rec.tableOfContents.type_at).to eq(['partial contents'])
331
331
  end
332
332
  end
333
333
 
334
334
  context "<targetAudience> child element" do
335
335
  it ".targetAudience.displayLabel should be an accessor for displayLabel attribute on targetAudience element: <targetAudience displayLabel='foo'>" do
336
336
  @mods_rec.from_str(@mods_el_w_ns + '<targetAudience displayLabel="ta da">blah blah</targetAudience></mods>')
337
- @mods_rec.targetAudience.displayLabel.should == ['ta da']
337
+ expect(@mods_rec.targetAudience.displayLabel).to eq(['ta da'])
338
338
  end
339
339
  it "should recognize all authority attributes" do
340
340
  Mods::AUTHORITY_ATTRIBS.each { |a|
341
341
  @mods_rec.from_str(@mods_el_w_ns + "<targetAudience #{a}='attr_val'>zzz</targetAudience></mods>")
342
- @mods_rec.targetAudience.send(a.to_sym).should == ['attr_val']
342
+ expect(@mods_rec.targetAudience.send(a.to_sym)).to eq(['attr_val'])
343
343
  }
344
344
  end
345
345
  end
@@ -347,19 +347,19 @@ describe "Mods Top Level Elements that do not have Child Elements" do
347
347
  context "<typeOfResource> child element" do
348
348
  it ".typeOfResource.collection should be an accessor for collection attribute on typeOfResource element: <typeOfResource collection='foo'>" do
349
349
  @mods_rec.from_str(@mods_el_w_ns + '<typeOfResource collection="yes">blah blah blah</typeOfResource></mods>')
350
- @mods_rec.typeOfResource.collection.should == ['yes']
350
+ expect(@mods_rec.typeOfResource.collection).to eq(['yes'])
351
351
  end
352
352
  it ".typeOfResource.displayLabel should be an accessor for displayLabel attribute on typeOfResource element: <typeOfResource displayLabel='foo'>" do
353
353
  @mods_rec.from_str(@mods_el_w_ns + '<typeOfResource displayLabel="Summary">blah blah blah</typeOfResource></mods>')
354
- @mods_rec.typeOfResource.displayLabel.should == ['Summary']
354
+ expect(@mods_rec.typeOfResource.displayLabel).to eq(['Summary'])
355
355
  end
356
356
  it ".typeOfResource.manuscript should be an accessor for manuscript attribute on typeOfResource element: <typeOfResource manuscript='foo'>" do
357
357
  @mods_rec.from_str(@mods_el_w_ns + '<typeOfResource manuscript="yes">blah blah blah</typeOfResource></mods>')
358
- @mods_rec.typeOfResource.manuscript.should == ['yes']
358
+ expect(@mods_rec.typeOfResource.manuscript).to eq(['yes'])
359
359
  end
360
360
  it ".typeOfResource.usage should be an accessor for usage attribute on typeOfResource element: <typeOfResource usage='foo'>" do
361
361
  @mods_rec.from_str(@mods_el_w_ns + '<typeOfResource usage="fer sure">blah blah blah</typeOfResource></mods>')
362
- @mods_rec.typeOfResource.usage.should == ['fer sure']
362
+ expect(@mods_rec.typeOfResource.usage).to eq(['fer sure'])
363
363
  end
364
364
  end
365
365