pump 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,12 +6,12 @@ describe Pump::Json do
6
6
  let(:json) { Pump::Json.new('person', [{:name => :name}]) }
7
7
 
8
8
  it "requires one object" do
9
- lambda{ json.encode }.should raise_error(ArgumentError)
10
- lambda{ json.encode(person) }.should_not raise_error
9
+ expect{ json.encode }.to raise_error(ArgumentError)
10
+ expect{ json.encode(person) }.not_to raise_error
11
11
  end
12
12
 
13
13
  it "returns json string" do
14
- json.encode(person).should eql("{\"person\":{\"name\":\"Benny\"}}")
14
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Benny\"}}")
15
15
  end
16
16
 
17
17
  context "with time object" do
@@ -19,7 +19,7 @@ describe Pump::Json do
19
19
  let(:json) { Pump::Json.new('person', [{:born => :born}]) }
20
20
 
21
21
  it "formats time as iso string" do
22
- json.encode(person).should eql("{\"person\":{\"born\":\"2007-11-01T15:25:00+09:00\"}}")
22
+ expect(json.encode(person)).to eql("{\"person\":{\"born\":\"2007-11-01T15:25:00+09:00\"}}")
23
23
  end
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ describe Pump::Json do
28
28
  let(:json) { Pump::Json.new('person', [{:born => :born}]) }
29
29
 
30
30
  it "formats time as iso string" do
31
- json.encode(person).should eql("{\"person\":{\"born\":\"2007-11-01\"}}")
31
+ expect(json.encode(person)).to eql("{\"person\":{\"born\":\"2007-11-01\"}}")
32
32
  end
33
33
  end
34
34
 
@@ -37,7 +37,7 @@ describe Pump::Json do
37
37
  let(:json) { Pump::Json.new('person', [{:born => :born}]) }
38
38
 
39
39
  it "formats time as iso string" do
40
- json.encode(person).should eql("{\"person\":{\"born\":\"2007-11-01T15:25:00+09:00\"}}")
40
+ expect(json.encode(person)).to eql("{\"person\":{\"born\":\"2007-11-01T15:25:00+09:00\"}}")
41
41
  end
42
42
  end
43
43
 
@@ -47,7 +47,7 @@ describe Pump::Json do
47
47
  let(:people) { [person] }
48
48
 
49
49
  it "returns json string" do
50
- json.encode(people).should eql("[{\"person\":{\"name\":\"Benny\"}}]")
50
+ expect(json.encode(people)).to eql("[{\"person\":{\"name\":\"Benny\"}}]")
51
51
  end
52
52
  end
53
53
 
@@ -55,12 +55,12 @@ describe Pump::Json do
55
55
  let(:people) { [person, Struct.new(:name, :age).new('Carlo', 5)] }
56
56
 
57
57
  it "returns xml string" do
58
- json.encode(people).should eql("[{\"person\":{\"name\":\"Benny\"}},{\"person\":{\"name\":\"Carlo\"}}]")
58
+ expect(json.encode(people)).to eql("[{\"person\":{\"name\":\"Benny\"}},{\"person\":{\"name\":\"Carlo\"}}]")
59
59
  end
60
60
 
61
61
  context "with exclude_root_in_json option" do
62
62
  it "returns json string without root" do
63
- json.encode(people, :exclude_root_in_json => true).should eql("[{\"name\":\"Benny\"},{\"name\":\"Carlo\"}]")
63
+ expect(json.encode(people, :exclude_root_in_json => true)).to eql("[{\"name\":\"Benny\"},{\"name\":\"Carlo\"}]")
64
64
  end
65
65
  end
66
66
  end
@@ -69,7 +69,7 @@ describe Pump::Json do
69
69
  let(:people) { [] }
70
70
 
71
71
  it "returns xml string" do
72
- json.encode(people).should eql("[]")
72
+ expect(json.encode(people)).to eql("[]")
73
73
  end
74
74
  end
75
75
  end
@@ -78,7 +78,7 @@ describe Pump::Json do
78
78
  let(:person) { Struct.new(:name, :age).new('', 9) }
79
79
 
80
80
  it do
81
- json.encode(person).should eql("{\"person\":{\"name\":\"\"}}")
81
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"\"}}")
82
82
  end
83
83
  end
84
84
 
@@ -86,7 +86,7 @@ describe Pump::Json do
86
86
  let(:person) { Struct.new(:name, :age).new(nil, 9) }
87
87
 
88
88
  it do
89
- json.encode(person).should eql("{\"person\":{\"name\":null}}")
89
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":null}}")
90
90
  end
91
91
  end
92
92
 
@@ -97,7 +97,7 @@ describe Pump::Json do
97
97
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :if => :is_young}]) }
98
98
 
99
99
  it "skips key-value on false" do
100
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
100
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
101
101
  end
102
102
  end
103
103
 
@@ -105,7 +105,7 @@ describe Pump::Json do
105
105
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :unless => :is_old}]) }
106
106
 
107
107
  it "skips key-value on false" do
108
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
108
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
109
109
  end
110
110
  end
111
111
 
@@ -114,7 +114,7 @@ describe Pump::Json do
114
114
  let(:people) { [person, Struct.new(:name, :age).new('Schewardnadse', nil)] }
115
115
 
116
116
  it "skips key-value on false" do
117
- json.encode(people).should eql("[{\"person\":{\"name\":\"Gorbatschow\",\"age\":82}},{\"person\":{\"name\":\"Schewardnadse\"}}]")
117
+ expect(json.encode(people)).to eql("[{\"person\":{\"name\":\"Gorbatschow\",\"age\":82}},{\"person\":{\"name\":\"Schewardnadse\"}}]")
118
118
  end
119
119
  end
120
120
  end
@@ -126,7 +126,7 @@ describe Pump::Json do
126
126
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :static_value => 12}]) }
127
127
 
128
128
  it "returns given static_value" do
129
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":12}}")
129
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":12}}")
130
130
  end
131
131
  end
132
132
 
@@ -134,7 +134,7 @@ describe Pump::Json do
134
134
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :static_value => nil}]) }
135
135
 
136
136
  it "returns given static_value" do
137
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":null}}")
137
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":null}}")
138
138
  end
139
139
  end
140
140
 
@@ -142,7 +142,7 @@ describe Pump::Json do
142
142
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :static_value => 12, :if => :is_yount}]) }
143
143
 
144
144
  it "returns given static_value" do
145
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
145
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\"}}")
146
146
  end
147
147
  end
148
148
 
@@ -150,7 +150,7 @@ describe Pump::Json do
150
150
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age, :static_value => 12, :unless => :is_yount}]) }
151
151
 
152
152
  it "returns given static_value" do
153
- json.encode(person).should eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":12}}")
153
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gorbatschow\",\"age\":12}}")
154
154
  end
155
155
  end
156
156
  end
@@ -159,14 +159,14 @@ describe Pump::Json do
159
159
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:parent => [{:name => :name}, {:age => :age}]}]) }
160
160
 
161
161
  it "returns static string" do
162
- json.encode(person).should eql("{\"person\":{\"name\":\"Benny\",\"parent\":{\"name\":\"Benny\",\"age\":9}}}")
162
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Benny\",\"parent\":{\"name\":\"Benny\",\"age\":9}}}")
163
163
  end
164
164
 
165
165
  context "with static_value = nil" do
166
166
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:parent => [{:name => :name}, {:age => :age}], :static_value => nil}]) }
167
167
 
168
168
  it "uses static value" do
169
- json.encode(person).should eql("{\"person\":{\"name\":\"Benny\",\"parent\":null}}")
169
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Benny\",\"parent\":null}}")
170
170
  end
171
171
  end
172
172
 
@@ -174,7 +174,7 @@ describe Pump::Json do
174
174
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:parent => [{:name => :name}, {:age => :age}], :static_value => {}}]) }
175
175
 
176
176
  it "uses static value" do
177
- json.encode(person).should eql("{\"person\":{\"name\":\"Benny\",\"parent\":{}}}")
177
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Benny\",\"parent\":{}}}")
178
178
  end
179
179
  end
180
180
  end
@@ -190,14 +190,14 @@ describe Pump::Json do
190
190
  :array => [{:name => :name}]}]) }
191
191
 
192
192
  it "returns json string" do
193
- json.encode(person).should eql("{\"person\":{\"name\":\"Gustav\",\"children\":[{\"name\":\"Lilly\"},{\"name\":\"Lena\"}]}}")
193
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gustav\",\"children\":[{\"name\":\"Lilly\"},{\"name\":\"Lena\"}]}}")
194
194
  end
195
195
 
196
196
  context "with static_value = nil" do
197
197
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:children => :children,
198
198
  :array => [{:name => :name}], :static_value => nil}]) }
199
199
  it "uses static value" do
200
- json.encode(person).should eql("{\"person\":{\"name\":\"Gustav\",\"children\":[]}}")
200
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gustav\",\"children\":[]}}")
201
201
  end
202
202
  end
203
203
 
@@ -205,7 +205,7 @@ describe Pump::Json do
205
205
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:children => :children,
206
206
  :array => [{:name => :name}], :static_value => []}]) }
207
207
  it "uses static value" do
208
- json.encode(person).should eql("{\"person\":{\"name\":\"Gustav\",\"children\":[]}}")
208
+ expect(json.encode(person)).to eql("{\"person\":{\"name\":\"Gustav\",\"children\":[]}}")
209
209
  end
210
210
  end
211
211
  end
@@ -215,7 +215,7 @@ describe Pump::Json do
215
215
  let(:json) { Pump::Json.new('my-person', [{"first-name" => :name}]) }
216
216
 
217
217
  it "returns json string with underscores" do
218
- json.encode(person).should eql("{\"my_person\":{\"first_name\":\"Benny\"}}")
218
+ expect(json.encode(person)).to eql("{\"my_person\":{\"first_name\":\"Benny\"}}")
219
219
  end
220
220
  end
221
221
 
@@ -223,7 +223,7 @@ describe Pump::Json do
223
223
  let(:json) { Pump::Json.new('my-person', [{"first-name" => :name}], :json_key_style => :dashes) }
224
224
 
225
225
  it "returns json string with dashes" do
226
- json.encode(person).should eql("{\"my-person\":{\"first-name\":\"Benny\"}}")
226
+ expect(json.encode(person)).to eql("{\"my-person\":{\"first-name\":\"Benny\"}}")
227
227
  end
228
228
  end
229
229
 
@@ -231,18 +231,18 @@ describe Pump::Json do
231
231
  let(:json) { Pump::Json.new('my-person', [{"first-name" => :name}], :json_key_style => :underscores) }
232
232
 
233
233
  it "returns json string with underscores" do
234
- json.encode(person).should eql("{\"my_person\":{\"first_name\":\"Benny\"}}")
234
+ expect(json.encode(person)).to eql("{\"my_person\":{\"first_name\":\"Benny\"}}")
235
235
  end
236
236
  end
237
237
  end
238
238
 
239
239
  context "with :exclude_root_in_json option" do
240
240
  it "returns json string without root" do
241
- json.encode(person, :exclude_root_in_json => true).should eql("{\"name\":\"Benny\"}")
241
+ expect(json.encode(person, :exclude_root_in_json => true)).to eql("{\"name\":\"Benny\"}")
242
242
  end
243
243
 
244
244
  it "returns json string without root on array" do
245
- json.encode([person], :exclude_root_in_json => true).should eql("[{\"name\":\"Benny\"}]")
245
+ expect(json.encode([person], :exclude_root_in_json => true)).to eql("[{\"name\":\"Benny\"}]")
246
246
  end
247
247
  end
248
248
 
@@ -253,23 +253,23 @@ describe Pump::Json do
253
253
  ])}
254
254
 
255
255
  it "returns only specified fields" do
256
- json.encode(person, :fields => ['name']).should eql("{\"person\":{\"name\":\"Benny\"}}")
257
- json.encode(person, :fields => ['age']).should eql("{\"person\":{\"age\":9}}")
256
+ expect(json.encode(person, :fields => ['name'])).to eql("{\"person\":{\"name\":\"Benny\"}}")
257
+ expect(json.encode(person, :fields => ['age'])).to eql("{\"person\":{\"age\":9}}")
258
258
  end
259
259
 
260
260
  it "ignores unknown fields" do
261
- json.encode(person, :fields => ['name', 'unknown']).should eql("{\"person\":{\"name\":\"Benny\"}}")
262
- json.encode(person, :fields => ['unknown']).should eql("{\"person\":{}}")
261
+ expect(json.encode(person, :fields => ['name', 'unknown'])).to eql("{\"person\":{\"name\":\"Benny\"}}")
262
+ expect(json.encode(person, :fields => ['unknown'])).to eql("{\"person\":{}}")
263
263
  end
264
264
 
265
265
  it "accepts dasherized and underscored field names" do
266
- json.encode(person, :fields => ['name', 'last-name']).should eql("{\"person\":{\"name\":\"Benny\",\"last_name\":\"Hellman\"}}")
267
- json.encode(person, :fields => ['name', 'last_name']).should eql("{\"person\":{\"name\":\"Benny\",\"last_name\":\"Hellman\"}}")
266
+ expect(json.encode(person, :fields => ['name', 'last-name'])).to eql("{\"person\":{\"name\":\"Benny\",\"last_name\":\"Hellman\"}}")
267
+ expect(json.encode(person, :fields => ['name', 'last_name'])).to eql("{\"person\":{\"name\":\"Benny\",\"last_name\":\"Hellman\"}}")
268
268
  end
269
269
 
270
270
  context "deep hash-like nesting" do
271
271
  it "adds all keys if fields contains parent" do
272
- json.encode(person, :fields => ['name', 'parent']).should eql(
272
+ expect(json.encode(person, :fields => ['name', 'parent'])).to eql(
273
273
  "{\"person\":{\"name\":\"Benny\",\"parent\":{\"name\":\"Benny\",\"age\":9}}}"
274
274
  )
275
275
  end
@@ -286,7 +286,7 @@ describe Pump::Json do
286
286
  :array => [{:name => :name}, {:age => :age}]}]) }
287
287
 
288
288
  it "adds all keys if fields contains children" do
289
- json.encode(person, :fields => ['name', 'children']).should eql(
289
+ expect(json.encode(person, :fields => ['name', 'children'])).to eql(
290
290
  "{\"person\":{\"name\":\"Gustav\",\"children\":[{\"name\":\"Lilly\",\"age\":2},{\"name\":\"Lena\",\"age\":3}]}}"
291
291
  )
292
292
  end
@@ -303,9 +303,9 @@ describe Pump::Json do
303
303
  let(:json) { Pump::Json.new('person', [{:name => :name}, {:age => :age}]) }
304
304
 
305
305
  it "returns only specified fields" do
306
- json.encode(people, :fields => ['name']).should eql("[{\"person\":{\"name\":\"Gustav\"}},{\"person\":{\"name\":\"Mary\"}}]")
306
+ expect(json.encode(people, :fields => ['name'])).to eql("[{\"person\":{\"name\":\"Gustav\"}},{\"person\":{\"name\":\"Mary\"}}]")
307
307
  end
308
308
  end
309
309
  end
310
310
  end
311
- end
311
+ end
@@ -75,31 +75,31 @@ end
75
75
 
76
76
  describe Pump::Object do
77
77
  it "should not extend all objects by default" do
78
- ObjectWithoutInclude.respond_to?(:pumps).should eql(false)
78
+ expect(ObjectWithoutInclude.respond_to?(:pumps)).to eql(false)
79
79
  end
80
80
 
81
81
  context "when included" do
82
82
  subject { ObjectWithInclude }
83
83
 
84
84
  it "should add pumps class method" do
85
- subject.respond_to?(:pumps).should eql(true)
86
- subject.pumps.size.should eql(0)
85
+ expect(subject.respond_to?(:pumps)).to eql(true)
86
+ expect(subject.pumps.size).to eql(0)
87
87
  end
88
88
 
89
89
  it "should add pump_to_xml instance method" do
90
- subject.new.respond_to?(:pump_to_xml).should eql(true)
90
+ expect(subject.new.respond_to?(:pump_to_xml)).to eql(true)
91
91
  end
92
92
 
93
93
  it "should add pump_to_json instance method" do
94
- subject.new.respond_to?(:pump_to_json).should eql(true)
94
+ expect(subject.new.respond_to?(:pump_to_json)).to eql(true)
95
95
  end
96
96
 
97
97
  it "should fall back to original to_xml on pump_to_xml" do
98
- subject.new.pump_to_xml.should eql("<to_xml />")
98
+ expect(subject.new.pump_to_xml).to eql("<to_xml />")
99
99
  end
100
100
 
101
101
  it "should fall back to original to_json on pump_to_xml" do
102
- subject.new.pump_to_json.should eql("{to_json}")
102
+ expect(subject.new.pump_to_json).to eql("{to_json}")
103
103
  end
104
104
  end
105
105
 
@@ -107,19 +107,19 @@ describe Pump::Object do
107
107
  subject { ObjectWithIncludeAndPumps }
108
108
 
109
109
  it "should add pump" do
110
- subject.pumps.size.should eql(1)
110
+ expect(subject.pumps.size).to eql(1)
111
111
  end
112
112
 
113
113
  it "should return xml on pump_to_xml" do
114
- subject.new.pump_to_xml.should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
114
+ expect(subject.new.pump_to_xml).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
115
115
  end
116
116
 
117
117
  it "should return json on pump_to_json" do
118
- subject.new.pump_to_json.should eql("{\"my_object\":{\"name\":\"MyName\"}}")
118
+ expect(subject.new.pump_to_json).to eql("{\"my_object\":{\"name\":\"MyName\"}}")
119
119
  end
120
120
 
121
121
  it "should pass down options to encoder" do
122
- subject.new.pump_to_json(:exclude_root_in_json => true).should eql("{\"name\":\"MyName\"}")
122
+ expect(subject.new.pump_to_json(:exclude_root_in_json => true)).to eql("{\"name\":\"MyName\"}")
123
123
  end
124
124
  end
125
125
 
@@ -127,31 +127,31 @@ describe Pump::Object do
127
127
  subject { ObjectWithIncludeAndMultiplePumps }
128
128
 
129
129
  it "should add pumps" do
130
- subject.pumps.size.should eql(2)
130
+ expect(subject.pumps.size).to eql(2)
131
131
  end
132
132
 
133
133
  it "should return default xml on pump_to_xml" do
134
- subject.new.pump_to_xml.should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
134
+ expect(subject.new.pump_to_xml).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
135
135
  end
136
136
 
137
137
  it "should return special xml on set option" do
138
- subject.new.pump_to_xml(:set => :sometimes).should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <age type=\"integer\">72</age>\n</my-object>\n")
138
+ expect(subject.new.pump_to_xml(:set => :sometimes)).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <age type=\"integer\">72</age>\n</my-object>\n")
139
139
  end
140
140
 
141
141
  it "should return default xml on pump_to_xml with unknown set option" do
142
- subject.new.pump_to_xml(:set => :unknown).should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
142
+ expect(subject.new.pump_to_xml(:set => :unknown)).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n</my-object>\n")
143
143
  end
144
144
 
145
145
  it "should return default json on pump_to_json" do
146
- subject.new.pump_to_json.should eql("{\"my_object\":{\"name\":\"MyName\"}}")
146
+ expect(subject.new.pump_to_json).to eql("{\"my_object\":{\"name\":\"MyName\"}}")
147
147
  end
148
148
 
149
149
  it "should return special json on set option" do
150
- subject.new.pump_to_json(:set => :sometimes).should eql("{\"my_object\":{\"name\":\"MyName\",\"age\":72}}")
150
+ expect(subject.new.pump_to_json(:set => :sometimes)).to eql("{\"my_object\":{\"name\":\"MyName\",\"age\":72}}")
151
151
  end
152
152
 
153
153
  it "should return default json on pump_to_json with unknown set option" do
154
- subject.new.pump_to_json(:set => :unknown).should eql("{\"my_object\":{\"name\":\"MyName\"}}")
154
+ expect(subject.new.pump_to_json(:set => :unknown)).to eql("{\"my_object\":{\"name\":\"MyName\"}}")
155
155
  end
156
156
  end
157
157
 
@@ -159,23 +159,23 @@ describe Pump::Object do
159
159
  subject { ObjectWithIncludeAndMultiplePumpsWithInheritance }
160
160
 
161
161
  it "should add pumps" do
162
- subject.pumps.size.should eql(2)
162
+ expect(subject.pumps.size).to eql(2)
163
163
  end
164
164
 
165
165
  it "should return default xml on pump_to_xml" do
166
- subject.new.pump_to_xml.should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <role>my_role</role>\n</my-object>\n")
166
+ expect(subject.new.pump_to_xml).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <role>my_role</role>\n</my-object>\n")
167
167
  end
168
168
 
169
169
  it "should return default json on pump_to_json" do
170
- subject.new.pump_to_json.should eql("{\"my_object\":{\"name\":\"MyName\",\"role\":\"my_role\"}}")
170
+ expect(subject.new.pump_to_json).to eql("{\"my_object\":{\"name\":\"MyName\",\"role\":\"my_role\"}}")
171
171
  end
172
172
 
173
173
  it "should return special inherited xml on pump_to_xml(:set => :restricted)" do
174
- subject.new.pump_to_xml(:set => :restricted).should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <role>basic_role</role>\n <age type=\"integer\">72</age>\n</my-object>\n")
174
+ expect(subject.new.pump_to_xml(:set => :restricted)).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<my-object>\n <name>MyName</name>\n <role>basic_role</role>\n <age type=\"integer\">72</age>\n</my-object>\n")
175
175
  end
176
176
 
177
177
  it "should return special inherited json on pump_to_json(:set => :restricted)" do
178
- subject.new.pump_to_json(:set => :restricted).should eql("{\"my_object\":{\"name\":\"MyName\",\"role\":\"basic_role\",\"age\":72}}")
178
+ expect(subject.new.pump_to_json(:set => :restricted)).to eql("{\"my_object\":{\"name\":\"MyName\",\"role\":\"basic_role\",\"age\":72}}")
179
179
  end
180
180
  end
181
181
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Pump::Xml::TagArray do
4
4
  describe ".new" do
5
5
  it "requires one parameter" do
6
- lambda{ Pump::Xml::TagArray.new }.should raise_error(ArgumentError)
7
- lambda{ Pump::Xml::TagArray.new('tag') }.should_not raise_error
6
+ expect{ Pump::Xml::TagArray.new }.to raise_error(ArgumentError)
7
+ expect{ Pump::Xml::TagArray.new('tag') }.not_to raise_error
8
8
  end
9
9
  end
10
10
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Pump::Xml::Tag do
4
4
  describe ".new" do
5
5
  it "requires one parameter" do
6
- lambda{ Pump::Xml::Tag.new }.should raise_error(ArgumentError)
7
- lambda{ Pump::Xml::Tag.new(0) }.should_not raise_error
6
+ expect{ Pump::Xml::Tag.new }.to raise_error(ArgumentError)
7
+ expect{ Pump::Xml::Tag.new(0) }.not_to raise_error
8
8
  end
9
9
  end
10
10
  end
@@ -5,8 +5,8 @@ describe Pump::Xml::Value do
5
5
 
6
6
  describe ".new" do
7
7
  it "requires one parameter" do
8
- lambda{ Pump::Xml::Value.new }.should raise_error(ArgumentError)
9
- lambda{ subject }.should_not raise_error
8
+ expect{ Pump::Xml::Value.new }.to raise_error(ArgumentError)
9
+ expect{ subject }.not_to raise_error
10
10
  end
11
11
  end
12
12
 
@@ -31,7 +31,7 @@ describe Pump::Xml::Value do
31
31
 
32
32
  context "with path name" do
33
33
  it do
34
- subject.to_s('custom_path').should eql("\#{remove_ilegal_chars custom_path.to_s.encode(:xml => :text)}")
34
+ expect(subject.to_s('custom_path')).to eql("\#{remove_ilegal_chars custom_path.to_s.encode(:xml => :text)}")
35
35
  end
36
36
  end
37
37
  end