@@ -20,7 +20,7 @@ def resulting_json
2020
2121 it "outputs the value as JSON" do
2222 r . element :name , "Fred"
23- resulting_json . should == %{"Fred"\n }
23+ expect ( resulting_json ) . to eq %{"Fred"\n }
2424 end
2525
2626 end
@@ -29,7 +29,7 @@ def resulting_json
2929
3030 it "outputs the value as JSON" do
3131 r . element :age , 36
32- resulting_json . should == "36\n "
32+ expect ( resulting_json ) . to eq "36\n "
3333 end
3434
3535 end
@@ -38,7 +38,7 @@ def resulting_json
3838
3939 it "generates null" do
4040 r . element :flavour , nil
41- resulting_json . should == "null\n "
41+ expect ( resulting_json ) . to eq "null\n "
4242 end
4343
4444 describe "and a block" do
@@ -47,7 +47,7 @@ def resulting_json
4747 r . element :book , nil do
4848 r . element :author
4949 end
50- resulting_json . should == "null\n "
50+ expect ( resulting_json ) . to eq "null\n "
5151 end
5252
5353 end
@@ -63,7 +63,7 @@ def resulting_json
6363 r . element :book , @book , :lang => :lang do
6464 r . element :title
6565 end
66- resulting_json . should == undent ( <<-JSON )
66+ expect ( resulting_json ) . to eq undent ( <<-JSON )
6767 {
6868 "@lang": "fr",
6969 "title": "En Edge"
@@ -77,7 +77,7 @@ def resulting_json
7777
7878 it "ignores the attributes" do
7979 r . element :review , "Blah de blah" , :lang => "fr"
80- resulting_json . should == undent ( <<-JSON )
80+ expect ( resulting_json ) . to eq undent ( <<-JSON )
8181 "Blah de blah"
8282 JSON
8383 end
@@ -93,7 +93,7 @@ def resulting_json
9393 r . representing ( @author ) do
9494 r . element :name
9595 end
96- resulting_json . should == %{"Fred"\n }
96+ expect ( resulting_json ) . to eq %{"Fred"\n }
9797 end
9898
9999 end
@@ -103,7 +103,7 @@ def resulting_json
103103 it "outputs an object" do
104104 r . element :something , Object . new do
105105 end
106- resulting_json . should == "{}\n "
106+ expect ( resulting_json ) . to eq "{}\n "
107107 end
108108
109109 end
@@ -116,7 +116,7 @@ def resulting_json
116116
117117 it "outputs the array as JSON" do
118118 r . list_of :names , %w( Hewey Dewey Louie )
119- resulting_json . should == undent ( <<-JSON )
119+ expect ( resulting_json ) . to eq undent ( <<-JSON )
120120 [
121121 "Hewey",
122122 "Dewey",
@@ -134,7 +134,7 @@ def resulting_json
134134 r . element ( :duck , @donald ) do
135135 r . list_of :nephews
136136 end
137- resulting_json . should == undent ( <<-JSON )
137+ expect ( resulting_json ) . to eq undent ( <<-JSON )
138138 {
139139 "nephews": [
140140 "Hewey",
@@ -159,7 +159,7 @@ def resulting_json
159159 r . element :name
160160 r . element :age
161161 end
162- resulting_json . should == undent ( <<-JSON )
162+ expect ( resulting_json ) . to eq undent ( <<-JSON )
163163 [
164164 {
165165 "name": "Hewey",
@@ -190,7 +190,7 @@ def resulting_json
190190 r . element :name
191191 r . element :age
192192 end
193- resulting_json . should == undent ( <<-JSON )
193+ expect ( resulting_json ) . to eq undent ( <<-JSON )
194194 [
195195 {
196196 "@about": "Hewey is 3 years old",
@@ -215,16 +215,18 @@ def resulting_json
215215 describe "with list attributes" do
216216 it "raises an ArgumentError" do
217217 @authors = [ ]
218- lambda { r . list_of ( :authors , @authors , :list_attributes => { } ) { } } . should raise_exception ( ArgumentError )
218+ expect ( -> {
219+ r . list_of ( :authors , @authors , :list_attributes => { } ) { }
220+ } ) . to raise_exception ( ArgumentError )
219221 end
220222 end
221223
222224 describe "with unnecessary arguments" do
223225 it "raises an ArgumentError" do
224226 @authors = [ ]
225- lambda {
227+ expect ( -> {
226228 r . list_of ( :authors , @authors , :unecessary_arg_should_cause_failure , :item_attributes => { } ) { }
227- } . should raise_exception ( ArgumentError )
229+ } ) . to raise_exception ( ArgumentError )
228230 end
229231 end
230232
@@ -234,7 +236,7 @@ def resulting_json
234236
235237 it "inserts a comment" do
236238 r . comment "now pay attention"
237- resulting_json . should == undent ( <<-JSON )
239+ expect ( resulting_json ) . to eq undent ( <<-JSON )
238240 // now pay attention
239241 JSON
240242 end
@@ -252,7 +254,7 @@ def resulting_json
252254 r . element :name , "Fred"
253255 r . element :age , 36
254256 end
255- resulting_json . should == undent ( <<-JSON )
257+ expect ( resulting_json ) . to eq undent ( <<-JSON )
256258 {
257259 "name": "Fred",
258260 "age": 36
@@ -268,7 +270,7 @@ def resulting_json
268270 r . element :name
269271 r . element :age
270272 end
271- resulting_json . should == undent ( <<-JSON )
273+ expect ( resulting_json ) . to eq undent ( <<-JSON )
272274 {
273275 "name": "Fred",
274276 "age": 36
@@ -287,7 +289,7 @@ def resulting_json
287289 r . attribute :href , "http://example.com/authors/1"
288290 r . element :name , "Fred"
289291 end
290- resulting_json . should == undent ( <<-JSON )
292+ expect ( resulting_json ) . to eq undent ( <<-JSON )
291293 {
292294 "@href": "http://example.com/authors/1",
293295 "name": "Fred"
@@ -306,7 +308,7 @@ def resulting_json
306308 r . comment "age is irrelevant"
307309 r . element :age
308310 end
309- resulting_json . should == undent ( <<-JSON )
311+ expect ( resulting_json ) . to eq undent ( <<-JSON )
310312 {
311313 "name": "Fred",
312314 // age is irrelevant
@@ -325,7 +327,7 @@ def resulting_json
325327 r . element :user , Object . new do
326328 r . element :full_name , "Fred Bloggs"
327329 end
328- resulting_json . should == undent ( <<-JSON )
330+ expect ( resulting_json ) . to eq undent ( <<-JSON )
329331 {
330332 "full_name": "Fred Bloggs"
331333 }
@@ -342,7 +344,7 @@ def resulting_json
342344 r . attribute :alt_url , "http://xyz.com"
343345 r . element :full_name
344346 end
345- resulting_json . should == undent ( <<-JSON )
347+ expect ( resulting_json ) . to eq undent ( <<-JSON )
346348 {
347349 "@altUrl": "http://xyz.com",
348350 "fullName": "Fred Bloggs"
@@ -368,7 +370,7 @@ def resulting_json
368370 r . element :name
369371 r . element :age
370372 end
371- resulting_json . should == undent ( <<-JSON )
373+ expect ( resulting_json ) . to eq undent ( <<-JSON )
372374 [
373375 {
374376 "name": "Hewey",
@@ -391,7 +393,7 @@ def resulting_json
391393 r . element :name
392394 r . element :age
393395 end
394- resulting_json . should == undent ( <<-JSON )
396+ expect ( resulting_json ) . to eq undent ( <<-JSON )
395397 [
396398 \t {
397399 \t \t "name": "Hewey",
@@ -414,7 +416,7 @@ def resulting_json
414416 r . element :name
415417 r . element :age
416418 end
417- resulting_json . should == %([{"name":"Hewey","age":3},{"name":"Dewey","age":4}])
419+ expect ( resulting_json ) . to eq %([{"name":"Hewey","age":3},{"name":"Dewey","age":4}])
418420 end
419421
420422 end
0 commit comments