zendesk_api 1.3.9 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +31 -21
  5. data/lib/zendesk_api/collection.rb +7 -0
  6. data/lib/zendesk_api/version.rb +1 -1
  7. data/spec/core/association_spec.rb +40 -40
  8. data/spec/core/client_spec.rb +37 -37
  9. data/spec/core/collection_spec.rb +81 -70
  10. data/spec/core/configuration_spec.rb +4 -4
  11. data/spec/core/create_resource_spec.rb +2 -2
  12. data/spec/core/data_resource_spec.rb +28 -28
  13. data/spec/core/inflection_spec.rb +1 -1
  14. data/spec/core/lru_cache_spec.rb +8 -8
  15. data/spec/core/middleware/request/encode_json_spec.rb +8 -8
  16. data/spec/core/middleware/request/etag_cache_spec.rb +5 -5
  17. data/spec/core/middleware/request/retry_spec.rb +10 -8
  18. data/spec/core/middleware/request/upload_spec.rb +25 -25
  19. data/spec/core/middleware/response/callback_spec.rb +1 -1
  20. data/spec/core/middleware/response/deflate_spec.rb +1 -1
  21. data/spec/core/middleware/response/gzip_spec.rb +1 -1
  22. data/spec/core/middleware/response/parse_iso_dates_spec.rb +9 -9
  23. data/spec/core/middleware/response/parse_json_spec.rb +4 -4
  24. data/spec/core/middleware/response/raise_error_spec.rb +2 -2
  25. data/spec/core/read_resource_spec.rb +6 -6
  26. data/spec/core/resource_spec.rb +66 -66
  27. data/spec/core/search_spec.rb +3 -3
  28. data/spec/core/spec_helper.rb +5 -4
  29. data/spec/core/trackie_spec.rb +17 -17
  30. data/spec/live/app_installation_spec.rb +2 -2
  31. data/spec/live/app_spec.rb +1 -1
  32. data/spec/live/audit_spec.rb +2 -2
  33. data/spec/live/collection_spec.rb +8 -8
  34. data/spec/live/locale_spec.rb +1 -1
  35. data/spec/live/macro_spec.rb +4 -4
  36. data/spec/live/setting_spec.rb +1 -1
  37. data/spec/live/tag_spec.rb +7 -7
  38. data/spec/live/ticket_spec.rb +10 -10
  39. data/spec/live/topic_comment_spec.rb +2 -2
  40. data/spec/live/topic_spec.rb +2 -2
  41. data/spec/live/user_spec.rb +15 -15
  42. data/spec/macros/resource_macros.rb +17 -17
  43. metadata +2 -2
@@ -12,6 +12,6 @@ describe ZendeskAPI::Middleware::Response::Callback do
12
12
  end
13
13
 
14
14
  it "should call callbacks " do
15
- client.connection.get("test_endpoint").body.should == response
15
+ expect(client.connection.get("test_endpoint").body).to eq(response)
16
16
  end
17
17
  end
@@ -15,7 +15,7 @@ describe ZendeskAPI::Middleware::Response::Deflate do
15
15
  end
16
16
 
17
17
  it "should inflate returned body" do
18
- client.connection.get("blergh").body['TESTDATA'].should be_true
18
+ expect(client.connection.get("blergh").body['TESTDATA']).to be(true)
19
19
  end
20
20
  end
21
21
  end
@@ -19,7 +19,7 @@ describe ZendeskAPI::Middleware::Response::Gzip do
19
19
  end
20
20
 
21
21
  it "should inflate returned body" do
22
- client.connection.get("blergh").body['TESTDATA'].should be_true
22
+ expect(client.connection.get("blergh").body['TESTDATA']).to be(true)
23
23
  end
24
24
  end
25
25
  end
@@ -4,7 +4,7 @@ describe ZendeskAPI::Middleware::Response::ParseIsoDates do
4
4
  def fake_response(data)
5
5
  stub_json_request(:get, %r{blergh}, data)
6
6
  response = client.connection.get("blergh")
7
- response.status.should == 200
7
+ expect(response.status).to eq(200)
8
8
  response
9
9
  end
10
10
 
@@ -17,28 +17,28 @@ describe ZendeskAPI::Middleware::Response::ParseIsoDates do
17
17
  }
18
18
 
19
19
  it "should parse dates" do
20
- fake_response('{"x":"2012-02-01T13:14:15Z"}').body["x"].to_s.should == parsed
20
+ expect(fake_response('{"x":"2012-02-01T13:14:15Z"}').body["x"].to_s).to eq(parsed)
21
21
  end
22
22
 
23
23
  it "should parse nested dates in hash" do
24
- fake_response('{"x":{"y":"2012-02-01T13:14:15Z"}}').body["x"]["y"].to_s.should == parsed
24
+ expect(fake_response('{"x":{"y":"2012-02-01T13:14:15Z"}}').body["x"]["y"].to_s).to eq(parsed)
25
25
  end
26
26
 
27
27
  it "should parse nested dates in arrays" do
28
- fake_response('{"x":[{"y":"2012-02-01T13:14:15Z"}]}').body["x"][0]["y"].to_s.should == parsed
28
+ expect(fake_response('{"x":[{"y":"2012-02-01T13:14:15Z"}]}').body["x"][0]["y"].to_s).to eq(parsed)
29
29
  end
30
30
 
31
31
  it "should not blow up on empty body" do
32
- fake_response('').body.should == nil
32
+ expect(fake_response('').body).to eq(nil)
33
33
  end
34
34
 
35
35
  it "should leave arrays with ids alone" do
36
- fake_response('{"x":[1,2,3]}').body.should == {"x" => [1,2,3]}
36
+ expect(fake_response('{"x":[1,2,3]}').body).to eq({"x" => [1,2,3]})
37
37
  end
38
38
 
39
39
  it "should not parse date-like things" do
40
- fake_response('{"x":"2012-02-01T13:14:15Z bla"}').body["x"].to_s.should == "2012-02-01T13:14:15Z bla"
41
- fake_response('{"x":"12012-02-01T13:14:15Z"}').body["x"].to_s.should == "12012-02-01T13:14:15Z"
42
- fake_response(%Q{{"x":"2012-02-01T13:14:15Z\\nfoo"}}).body["x"].to_s.should == "2012-02-01T13:14:15Z\nfoo"
40
+ expect(fake_response('{"x":"2012-02-01T13:14:15Z bla"}').body["x"].to_s).to eq("2012-02-01T13:14:15Z bla")
41
+ expect(fake_response('{"x":"12012-02-01T13:14:15Z"}').body["x"].to_s).to eq("12012-02-01T13:14:15Z")
42
+ expect(fake_response(%Q{{"x":"2012-02-01T13:14:15Z\\nfoo"}}).body["x"].to_s).to eq("2012-02-01T13:14:15Z\nfoo")
43
43
  end
44
44
  end
@@ -12,7 +12,7 @@ describe ZendeskAPI::Middleware::Response::ParseJson do
12
12
  end
13
13
 
14
14
  it "should return nil body" do
15
- client.connection.get("blergh").body.should be_nil
15
+ expect(client.connection.get("blergh").body).to be_nil
16
16
  end
17
17
  end
18
18
 
@@ -30,7 +30,7 @@ describe ZendeskAPI::Middleware::Response::ParseJson do
30
30
  let(:body) { nil }
31
31
 
32
32
  it "should return nil body" do
33
- client.connection.get("blergh").body.should be_nil
33
+ expect(client.connection.get("blergh").body).to be_nil
34
34
  end
35
35
  end
36
36
 
@@ -38,7 +38,7 @@ describe ZendeskAPI::Middleware::Response::ParseJson do
38
38
  let(:body) { '' }
39
39
 
40
40
  it "should return nil body" do
41
- client.connection.get("blergh").body.should be_nil
41
+ expect(client.connection.get("blergh").body).to be_nil
42
42
  end
43
43
  end
44
44
 
@@ -46,7 +46,7 @@ describe ZendeskAPI::Middleware::Response::ParseJson do
46
46
  let(:body) { '{ "TESTDATA": true }' }
47
47
 
48
48
  it "should parse returned body" do
49
- client.connection.get("blergh").body['TESTDATA'].should be_true
49
+ expect(client.connection.get("blergh").body['TESTDATA']).to be(true)
50
50
  end
51
51
  end
52
52
  end
@@ -61,8 +61,8 @@ describe ZendeskAPI::Middleware::Response::RaiseError do
61
61
  begin
62
62
  client.connection.get "/non_existent"
63
63
  rescue ZendeskAPI::Error::RecordInvalid => e
64
- e.errors.should == "hello"
65
- e.to_s.should == "ZendeskAPI::Error::RecordInvalid: hello"
64
+ expect(e.errors).to eq("hello")
65
+ expect(e.to_s).to eq("ZendeskAPI::Error::RecordInvalid: hello")
66
66
  else
67
67
  fail # didn't raise an error
68
68
  end
@@ -11,7 +11,7 @@ describe ZendeskAPI::ReadResource do
11
11
  end
12
12
 
13
13
  it "should return instance of resource" do
14
- subject.find(client, :id => id).should be_instance_of(subject)
14
+ expect(subject.find(client, :id => id)).to be_instance_of(subject)
15
15
  end
16
16
  end
17
17
 
@@ -40,8 +40,8 @@ describe ZendeskAPI::ReadResource do
40
40
 
41
41
  it "should return instance of resource" do
42
42
  object = subject.find(client, :id => id)
43
- object.should be_instance_of(subject)
44
- object.testing.should == 1
43
+ expect(object).to be_instance_of(subject)
44
+ expect(object.testing).to eq(1)
45
45
  end
46
46
  end
47
47
 
@@ -57,19 +57,19 @@ describe ZendeskAPI::ReadResource do
57
57
  end
58
58
 
59
59
  it "should side load nil resource" do
60
- @resource.nil_resource.name.should == "hi"
60
+ expect(@resource.nil_resource.name).to eq("hi")
61
61
  end
62
62
  end
63
63
 
64
64
  context "with client error" do
65
65
  it "should handle 500 properly" do
66
66
  stub_request(:get, %r{test_resources/#{id}}).to_return(:status => 500)
67
- subject.find(client, :id => id).should == nil
67
+ expect(subject.find(client, :id => id)).to eq(nil)
68
68
  end
69
69
 
70
70
  it "should handle 404 properly" do
71
71
  stub_request(:get, %r{test_resources/#{id}}).to_return(:status => 404)
72
- subject.find(client, :id => id).should == nil
72
+ expect(subject.find(client, :id => id)).to eq(nil)
73
73
  end
74
74
  end
75
75
  end
@@ -5,7 +5,7 @@ describe ZendeskAPI::Resource do
5
5
  context "with :global as part of attributes" do
6
6
  it "should set @global_params" do
7
7
  resource = ZendeskAPI::TestResource.new(client, { :global => { :something => 'hey' }})
8
- resource.instance_variable_get(:@global_params).should == { :something => 'hey' }
8
+ expect(resource.instance_variable_get(:@global_params)).to eq({ :something => 'hey' })
9
9
  end
10
10
  end
11
11
  end
@@ -20,7 +20,7 @@ describe ZendeskAPI::Resource do
20
20
  end
21
21
 
22
22
  it "should return instance of resource" do
23
- subject.update(client, :id => id, :test => :hello).should be_true
23
+ expect(subject.update(client, :id => id, :test => :hello)).to be_truthy
24
24
  end
25
25
 
26
26
  context "with global params" do
@@ -29,7 +29,7 @@ describe ZendeskAPI::Resource do
29
29
  end
30
30
 
31
31
  it "should return instance of resource" do
32
- subject.update(client, :id => id, :test => :hello, :global => {:something => "something"}).should be_true
32
+ expect(subject.update(client, :id => id, :test => :hello, :global => {:something => "something"})).to be_truthy
33
33
  end
34
34
  end
35
35
 
@@ -39,7 +39,7 @@ describe ZendeskAPI::Resource do
39
39
  end
40
40
 
41
41
  it "should handle it properly" do
42
- expect { silence_logger{ subject.update(client, :id => id).should be_false } }.to_not raise_error
42
+ expect { silence_logger{ expect(subject.update(client, :id => id)).to be(false) } }.to_not raise_error
43
43
  end
44
44
  end
45
45
  end
@@ -55,7 +55,7 @@ describe ZendeskAPI::Resource do
55
55
  end
56
56
 
57
57
  it "should return instance of resource" do
58
- subject.destroy(client, :id => id).should be_true
58
+ expect(subject.destroy(client, :id => id)).to be(true)
59
59
  end
60
60
 
61
61
  context "with client error" do
@@ -64,7 +64,7 @@ describe ZendeskAPI::Resource do
64
64
  end
65
65
 
66
66
  it "should handle it properly" do
67
- expect { silence_logger{ subject.destroy(client, :id => id).should be_false } }.to_not raise_error
67
+ expect { silence_logger{ expect(subject.destroy(client, :id => id)).to be(false) } }.to_not raise_error
68
68
  end
69
69
  end
70
70
  end
@@ -77,9 +77,9 @@ describe ZendeskAPI::Resource do
77
77
  end
78
78
 
79
79
  it "should return true and set destroyed" do
80
- subject.destroy.should be_true
81
- subject.destroyed?.should be_true
82
- subject.destroy.should be_false
80
+ expect(subject.destroy).to be(true)
81
+ expect(subject.destroyed?).to be(true)
82
+ expect(subject.destroy).to be(false)
83
83
  end
84
84
 
85
85
  context "with client error" do
@@ -88,8 +88,8 @@ describe ZendeskAPI::Resource do
88
88
  end
89
89
 
90
90
  it "should return false and not set destroyed" do
91
- silence_logger{ subject.destroy.should be_false }
92
- subject.destroyed?.should be_false
91
+ silence_logger{ expect(subject.destroy).to be(false) }
92
+ expect(subject.destroyed?).to be(false)
93
93
  end
94
94
  end
95
95
  end
@@ -117,17 +117,17 @@ describe ZendeskAPI::Resource do
117
117
  end
118
118
 
119
119
  it "should not save if already destroyed" do
120
- subject.should_receive(:destroyed?).and_return(true)
121
- subject.save.should be_false
120
+ expect(subject).to receive(:destroyed?).and_return(true)
121
+ expect(subject.save).to be(false)
122
122
  end
123
123
 
124
124
  it "should not be a new record with an id" do
125
- subject.new_record?.should be_false
125
+ expect(subject.new_record?).to be(false)
126
126
  end
127
127
 
128
128
  it "should put on save" do
129
- subject.save.should be_true
130
- subject[:param].should == "abc"
129
+ expect(subject.save).to be(true)
130
+ expect(subject[:param]).to eq("abc")
131
131
  end
132
132
 
133
133
  context "with unused associations" do
@@ -138,7 +138,7 @@ describe ZendeskAPI::Resource do
138
138
  end
139
139
 
140
140
  it "should not touch them" do
141
- subject.save.should == true
141
+ expect(subject.save).to eq(true)
142
142
  end
143
143
  end
144
144
 
@@ -148,7 +148,7 @@ describe ZendeskAPI::Resource do
148
148
  end
149
149
 
150
150
  it "should be properly handled" do
151
- expect { silence_logger { subject.save.should be_false } }.to_not raise_error
151
+ expect { silence_logger { expect(subject.save).to be(false) } }.to_not raise_error
152
152
  end
153
153
  end
154
154
 
@@ -160,13 +160,13 @@ describe ZendeskAPI::Resource do
160
160
  end
161
161
 
162
162
  it "should be true without an id" do
163
- subject.new_record?.should be_true
163
+ expect(subject.new_record?).to be(true)
164
164
  end
165
165
 
166
166
  it "should be false after creating" do
167
- subject.save.should be_true
168
- subject.new_record?.should be_false
169
- subject.id.should == id
167
+ expect(subject.save).to be(true)
168
+ expect(subject.new_record?).to be(false)
169
+ expect(subject.id).to eq(id)
170
170
  end
171
171
  end
172
172
 
@@ -181,19 +181,19 @@ describe ZendeskAPI::Resource do
181
181
 
182
182
  it "should call save on the association" do
183
183
  subject.child.foo = "bar"
184
- subject.child.should_receive(:save)
184
+ expect(subject.child).to receive(:save)
185
185
 
186
186
  subject.save
187
187
 
188
- subject.instance_variable_get(:@child).should be_nil
188
+ expect(subject.instance_variable_get(:@child)).to be_nil
189
189
  end
190
190
 
191
191
  it "should not call save on the association if they are synced" do
192
- subject.child.should_not_receive(:save)
192
+ expect(subject.child).to_not receive(:save)
193
193
 
194
194
  subject.save
195
195
 
196
- subject.instance_variable_get(:@child).should be_nil
196
+ expect(subject.instance_variable_get(:@child)).to be_nil
197
197
  end
198
198
  end
199
199
 
@@ -210,37 +210,37 @@ describe ZendeskAPI::Resource do
210
210
  subject.children = [2, 3]
211
211
  subject.children_ids = [1]
212
212
  subject.save
213
- subject.children_ids.should == [2,3]
214
- subject.instance_variable_get(:@children).should be_nil
213
+ expect(subject.children_ids).to eq([2,3])
214
+ expect(subject.instance_variable_get(:@children)).to be_nil
215
215
  end
216
216
 
217
217
  it "should not save the associated objects when there are no changes" do
218
218
  subject.children = [2]
219
- subject.children.first.should_not_receive(:save)
219
+ expect(subject.children.first).to_not receive(:save)
220
220
  subject.save
221
- subject.instance_variable_get(:@children).should be_nil
221
+ expect(subject.instance_variable_get(:@children)).to be_nil
222
222
  end
223
223
 
224
224
  it "should save the associated objects when it is new" do
225
225
  subject.children = [{:foo => "bar"}]
226
- subject.children.first.should_receive(:save)
226
+ expect(subject.children.first).to receive(:save)
227
227
  subject.save
228
- subject.instance_variable_get(:@children).should be_nil
228
+ expect(subject.instance_variable_get(:@children)).to be_nil
229
229
  end
230
230
 
231
231
  it "should not save the associated objects when it is set via full hash" do
232
232
  subject.children = [{:id => 1, :foo => "bar"}]
233
- subject.children.first.should_not_receive(:save)
233
+ expect(subject.children.first).to_not receive(:save)
234
234
  subject.save
235
- subject.instance_variable_get(:@children).should be_nil
235
+ expect(subject.instance_variable_get(:@children)).to be_nil
236
236
  end
237
237
 
238
238
  it "should save the associated objects when it is changes" do
239
239
  subject.children = [{:id => 1}]
240
240
  subject.children.first.foo = "bar"
241
- subject.children.first.should_receive(:save)
241
+ expect(subject.children.first).to receive(:save)
242
242
  subject.save
243
- subject.instance_variable_get(:@children).should be_nil
243
+ expect(subject.instance_variable_get(:@children)).to be_nil
244
244
  end
245
245
  end
246
246
 
@@ -263,14 +263,14 @@ describe ZendeskAPI::Resource do
263
263
  it "should save param data" do
264
264
  subject.save_associations
265
265
 
266
- subject.attributes[:nil].should == "TESTDATA"
266
+ expect(subject.attributes[:nil]).to eq("TESTDATA")
267
267
  end
268
268
 
269
269
  it "should not save param data when unchanged" do
270
270
  subject.nil.clear_changes
271
271
  subject.save_associations
272
272
 
273
- subject.attributes[:nil].should be_nil
273
+ expect(subject.attributes[:nil]).to be_nil
274
274
  end
275
275
  end
276
276
 
@@ -287,7 +287,7 @@ describe ZendeskAPI::Resource do
287
287
  end
288
288
 
289
289
  it "should save param data" do
290
- subject.attributes[:nil].should == "TESTDATA"
290
+ expect(subject.attributes[:nil]).to eq("TESTDATA")
291
291
  end
292
292
  end
293
293
 
@@ -297,7 +297,7 @@ describe ZendeskAPI::Resource do
297
297
  end
298
298
 
299
299
  it "should not save param data" do
300
- subject.attributes[:nil].should be_nil
300
+ expect(subject.attributes[:nil]).to be_nil
301
301
  end
302
302
  end
303
303
  end
@@ -316,7 +316,7 @@ describe ZendeskAPI::Resource do
316
316
  subject { ZendeskAPI::TestResource }
317
317
 
318
318
  it "should create a method of the same name" do
319
- subject.instance_methods.map(&:to_s).should include(method)
319
+ expect(subject.instance_methods.map(&:to_s)).to include(method)
320
320
  end
321
321
  end
322
322
 
@@ -333,12 +333,12 @@ describe ZendeskAPI::Resource do
333
333
  end
334
334
 
335
335
  it "should return true" do
336
- subject.send(method, :verb => :put).should be_true
336
+ expect(subject.send(method, :verb => :put)).to be(true)
337
337
  end
338
338
 
339
339
  it "should update the attributes if they exist" do
340
340
  subject.send(method, :verb => :put)
341
- subject[:method].should == method
341
+ expect(subject[:method]).to eq(method)
342
342
  end
343
343
  end
344
344
 
@@ -348,12 +348,12 @@ describe ZendeskAPI::Resource do
348
348
  end
349
349
 
350
350
  it "should return true" do
351
- subject.send(method, :verb => :put).should be_true
351
+ expect(subject.send(method, :verb => :put)).to be(true)
352
352
  end
353
353
 
354
354
  it "should update the attributes if they exist" do
355
355
  subject.send(method, :verb => :put)
356
- subject[:method].should == method
356
+ expect(subject[:method]).to eq(method)
357
357
  end
358
358
  end
359
359
 
@@ -363,7 +363,7 @@ describe ZendeskAPI::Resource do
363
363
  end
364
364
 
365
365
  it "doesn't raise without bang" do
366
- silence_logger { subject.send("#{method}", :verb => :put).should be_false }
366
+ silence_logger { expect(subject.send("#{method}", :verb => :put)).to be(false) }
367
367
  end
368
368
 
369
369
  it "raises with bang" do
@@ -384,7 +384,7 @@ describe ZendeskAPI::Resource do
384
384
  subject { ZendeskAPI::TestResource }
385
385
 
386
386
  it "should create a method of the same name" do
387
- subject.instance_methods.map(&:to_s).should include(method)
387
+ expect(subject.instance_methods.map(&:to_s)).to include(method)
388
388
  end
389
389
  end
390
390
 
@@ -397,12 +397,12 @@ describe ZendeskAPI::Resource do
397
397
  end
398
398
 
399
399
  it "should return true" do
400
- subject.send(method).should be_true
400
+ expect(subject.send(method)).to be(true)
401
401
  end
402
402
 
403
403
  it "should update the attributes if they exist" do
404
404
  subject.send(method)
405
- subject[:method].should == method
405
+ expect(subject[:method]).to eq(method)
406
406
  end
407
407
  end
408
408
 
@@ -412,12 +412,12 @@ describe ZendeskAPI::Resource do
412
412
  end
413
413
 
414
414
  it "should return true" do
415
- subject.send(method).should be_true
415
+ expect(subject.send(method)).to be(true)
416
416
  end
417
417
 
418
418
  it "should update the attributes if they exist" do
419
419
  subject.send(method)
420
- subject[:method].should == method
420
+ expect(subject[:method]).to eq(method)
421
421
  end
422
422
  end
423
423
 
@@ -427,7 +427,7 @@ describe ZendeskAPI::Resource do
427
427
  end
428
428
 
429
429
  it "doesn't raise without bang" do
430
- silence_logger { subject.send("#{method}").should be_false }
430
+ silence_logger { expect(subject.send("#{method}")).to be(false) }
431
431
  end
432
432
 
433
433
  it "raises with bang" do
@@ -440,7 +440,7 @@ describe ZendeskAPI::Resource do
440
440
 
441
441
  context "#inspect" do
442
442
  it "should display nicely" do
443
- ZendeskAPI::User.new(client, :foo => :bar).inspect.should == "#<ZendeskAPI::User {\"foo\"=>:bar}>"
443
+ expect(ZendeskAPI::User.new(client, :foo => :bar).inspect).to eq("#<ZendeskAPI::User {\"foo\"=>:bar}>")
444
444
  end
445
445
  end
446
446
 
@@ -448,49 +448,49 @@ describe ZendeskAPI::Resource do
448
448
  subject { ZendeskAPI::TestResource.new(client, :id => 1) }
449
449
 
450
450
  it "should call #to_json on @attributes" do
451
- subject.attributes.should_receive(:to_json)
451
+ expect(subject.attributes).to receive(:to_json)
452
452
  subject.to_json
453
453
  end
454
454
  end
455
455
 
456
456
  context "#==" do
457
457
  it "is same when id is same" do
458
- ZendeskAPI::TestResource.new(client, :id => 1, "bar" => "baz").should == ZendeskAPI::TestResource.new(client, :id => 1, "foo" => "bar")
458
+ expect(ZendeskAPI::TestResource.new(client, :id => 1, "bar" => "baz")).to eq(ZendeskAPI::TestResource.new(client, :id => 1, "foo" => "bar"))
459
459
  end
460
460
 
461
461
  it "is same when object_id is same" do
462
462
  object = ZendeskAPI::TestResource.new(client, "bar" => "baz")
463
- object.should == object
463
+ expect(object).to eq(object)
464
464
  end
465
465
 
466
466
  it "is different when both have no id" do
467
- ZendeskAPI::TestResource.new(client).should_not == ZendeskAPI::TestResource.new(client)
467
+ expect(ZendeskAPI::TestResource.new(client)).to_not eq(ZendeskAPI::TestResource.new(client))
468
468
  end
469
469
 
470
470
  it "is different when id is different" do
471
- ZendeskAPI::TestResource.new(client, :id => 2).should_not == ZendeskAPI::TestResource.new(client, :id => 1)
471
+ expect(ZendeskAPI::TestResource.new(client, :id => 2)).to_not eq(ZendeskAPI::TestResource.new(client, :id => 1))
472
472
  end
473
473
 
474
474
  it "is same when class is Data" do
475
- ZendeskAPI::TestResource.new(client, :id => 2).should == ZendeskAPI::TestResource::TestChild.new(client, :id => 2)
475
+ expect(ZendeskAPI::TestResource.new(client, :id => 2)).to eq(ZendeskAPI::TestResource::TestChild.new(client, :id => 2))
476
476
  end
477
477
 
478
478
  it "is same when class is Integer" do
479
- ZendeskAPI::TestResource.new(client, :id => 2).should == 2
479
+ expect(ZendeskAPI::TestResource.new(client, :id => 2)).to eq(2)
480
480
  end
481
481
 
482
482
  it "is different when class is Integer" do
483
- ZendeskAPI::TestResource.new(client, :id => 2).should_not == 3
483
+ expect(ZendeskAPI::TestResource.new(client, :id => 2)).to_not eq(3)
484
484
  end
485
485
 
486
486
  it "is different when other is no resource" do
487
- ZendeskAPI::TestResource.new(client, :id => 2).should_not == nil
487
+ expect(ZendeskAPI::TestResource.new(client, :id => 2)).to_not eq(nil)
488
488
  end
489
489
 
490
490
  it "warns about weird comparissons" do
491
491
  object = ZendeskAPI::TestResource.new(client, :id => 2)
492
- object.should_receive(:warn)
493
- object.should_not == "xxx"
492
+ expect(object).to receive(:warn)
493
+ expect(object).to_not eq("xxx")
494
494
  end
495
495
  end
496
496
 
@@ -522,14 +522,14 @@ describe ZendeskAPI::Resource do
522
522
  subject { ZendeskAPI::Ticket.new(client, :id => 1, :assignee_id => nil) }
523
523
 
524
524
  it "should not try and make a request" do
525
- subject.assignee.should be_nil
525
+ expect(subject.assignee).to be_nil
526
526
  end
527
527
  end
528
528
 
529
529
  context "#new" do
530
530
  it "builds with hash" do
531
531
  object = ZendeskAPI::TestResource.new(client, {})
532
- object.attributes.should == {}
532
+ expect(object.attributes).to eq({})
533
533
  end
534
534
 
535
535
  it "fails to build with nil (e.g. empty response from server)" do