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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29e998ef5ac29f169434e9f790efadefacb2643f
4
- data.tar.gz: 4c04948d4dbe97717235756b3d966f90de072b5a
3
+ metadata.gz: 1d07ce370fb28464897785ae66e33e426fc65b1f
4
+ data.tar.gz: df2e6e5fed6d5bb977b0707b7f46e7396a3c8c70
5
5
  SHA512:
6
- metadata.gz: 1ff31fb5fc88df8a3eba6d624fc838a6e2a339184dbd66749cefe7a097a6e01877524a95215f75bb8d7cb5625c43719aaf247a2df61df23dc2bc99368b364824
7
- data.tar.gz: 9a02b1a2563b332facca8b17a3a2469e3765a406c46ae1f5a39110b8a3cb206cd39417f5764903f48dd23626f4e0dcf81c64e06e25e2ee9cc5a8b10cb63363aa
6
+ metadata.gz: 789311dcc288abb846bd53a6301df3f1c60988aefec37949272d260e58a85d2fa3faca796f50814578fc377acf813b159fccbe67328a334405b81f596f58fbd6
7
+ data.tar.gz: 19fc5162ac0a2956a4d6a70cfe082d39dcfdc87d56f81e3c5a53c11442882a507485e5a61529f350700ffbc9d0b32da38f6fb825111b72c6212ba3f1aaf756c6
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format nested
2
+ --format documentation
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem "simplecov", :platforms => :ruby_19, :group => :test
4
4
  gem "jruby-openssl", :platforms => :jruby
5
5
 
6
6
  group :test do
7
+ gem "byebug", :platform => [:ruby_20, :ruby_21]
7
8
  gem "json", :platform => :ruby_18
8
9
 
9
10
  # only used for uploads testing
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zendesk_api (1.3.9)
4
+ zendesk_api (1.4.0)
5
5
  faraday (~> 0.9)
6
6
  hashie (>= 1.2)
7
7
  inflection
@@ -12,9 +12,9 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- actionpack (3.2.18)
16
- activemodel (= 3.2.18)
17
- activesupport (= 3.2.18)
15
+ actionpack (3.2.19)
16
+ activemodel (= 3.2.19)
17
+ activesupport (= 3.2.19)
18
18
  builder (~> 3.0.0)
19
19
  erubis (~> 2.7.0)
20
20
  journey (~> 1.0.4)
@@ -22,30 +22,35 @@ GEM
22
22
  rack-cache (~> 1.2)
23
23
  rack-test (~> 0.6.1)
24
24
  sprockets (~> 2.2.1)
25
- activemodel (3.2.18)
26
- activesupport (= 3.2.18)
25
+ activemodel (3.2.19)
26
+ activesupport (= 3.2.19)
27
27
  builder (~> 3.0.0)
28
- activesupport (3.2.18)
28
+ activesupport (3.2.19)
29
29
  i18n (~> 0.6, >= 0.6.4)
30
30
  multi_json (~> 1.0)
31
31
  addressable (2.3.6)
32
32
  builder (3.0.4)
33
33
  bump (0.5.0)
34
+ byebug (3.1.2)
35
+ columnize (~> 0.8)
36
+ debugger-linecache (~> 1.2)
37
+ columnize (0.8.9)
34
38
  crack (0.4.2)
35
39
  safe_yaml (~> 1.0.0)
40
+ debugger-linecache (1.2.0)
36
41
  diff-lcs (1.2.5)
37
- docile (1.1.3)
42
+ docile (1.1.5)
38
43
  erubis (2.7.0)
39
44
  faraday (0.9.0)
40
45
  multipart-post (>= 1.2, < 3)
41
- hashie (3.0.0)
46
+ hashie (3.2.0)
42
47
  hike (1.2.3)
43
- i18n (0.6.9)
48
+ i18n (0.6.11)
44
49
  inflection (1.0.0)
45
50
  journey (1.0.4)
46
51
  json (1.8.1)
47
52
  mime-types (1.25.1)
48
- multi_json (1.10.0)
53
+ multi_json (1.10.1)
49
54
  multipart-post (2.0.0)
50
55
  rack (1.4.5)
51
56
  rack-cache (1.2)
@@ -53,16 +58,20 @@ GEM
53
58
  rack-test (0.6.2)
54
59
  rack (>= 1.0)
55
60
  rake (10.3.2)
56
- rspec (2.14.1)
57
- rspec-core (~> 2.14.0)
58
- rspec-expectations (~> 2.14.0)
59
- rspec-mocks (~> 2.14.0)
60
- rspec-core (2.14.8)
61
- rspec-expectations (2.14.5)
62
- diff-lcs (>= 1.1.3, < 2.0)
63
- rspec-mocks (2.14.6)
61
+ rspec (3.0.0)
62
+ rspec-core (~> 3.0.0)
63
+ rspec-expectations (~> 3.0.0)
64
+ rspec-mocks (~> 3.0.0)
65
+ rspec-core (3.0.2)
66
+ rspec-support (~> 3.0.0)
67
+ rspec-expectations (3.0.2)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.0.0)
70
+ rspec-mocks (3.0.2)
71
+ rspec-support (~> 3.0.0)
72
+ rspec-support (3.0.2)
64
73
  safe_yaml (1.0.3)
65
- simplecov (0.8.2)
74
+ simplecov (0.9.0)
66
75
  docile (~> 1.1.0)
67
76
  multi_json
68
77
  simplecov-html (~> 0.8.0)
@@ -73,7 +82,7 @@ GEM
73
82
  rack (~> 1.0)
74
83
  tilt (~> 1.1, != 1.3.0)
75
84
  tilt (1.4.1)
76
- vcr (2.9.0)
85
+ vcr (2.9.2)
77
86
  webmock (1.18.0)
78
87
  addressable (>= 2.3.6)
79
88
  crack (>= 0.3.2)
@@ -85,6 +94,7 @@ PLATFORMS
85
94
  DEPENDENCIES
86
95
  actionpack (~> 3.2)
87
96
  bump
97
+ byebug
88
98
  jruby-openssl
89
99
  json
90
100
  rake
@@ -263,6 +263,10 @@ module ZendeskAPI
263
263
  # @private
264
264
  def to_ary; nil; end
265
265
 
266
+ def respond_to?(name)
267
+ super || Array.new.respond_to?(name)
268
+ end
269
+
266
270
  # Sends methods to underlying array of resources.
267
271
  def method_missing(name, *args, &block)
268
272
  if resource_methods.include?(name)
@@ -324,6 +328,9 @@ module ZendeskAPI
324
328
 
325
329
  self.next
326
330
  end
331
+
332
+ page(nil)
333
+ clear_cache
327
334
  end
328
335
 
329
336
  def _save(method = :save)
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.3.9"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -13,38 +13,38 @@ describe ZendeskAPI::Association do
13
13
 
14
14
  it "should not try and fetch nil child" do
15
15
  instance.child_id = nil
16
- instance.child.should be_nil
16
+ expect(instance.child).to be_nil
17
17
  end
18
18
 
19
19
  it "should cache an set object" do
20
20
  instance.child = child
21
- instance.child.should == child
21
+ expect(instance.child).to eq(child)
22
22
  end
23
23
 
24
24
  it "should set id on set if it was there" do
25
25
  instance.child_id = nil
26
26
  instance.child = child
27
- instance.child_id.should == child.id
27
+ expect(instance.child_id).to eq(child.id)
28
28
  end
29
29
 
30
30
  it "should build a object set via hash" do
31
31
  instance.child = {:id => 2}
32
- instance.child.id.should == 2
32
+ expect(instance.child.id).to eq(2)
33
33
  end
34
34
 
35
35
  it "should build a object set via id" do
36
36
  instance.child = 2
37
- instance.child.id.should == 2
37
+ expect(instance.child.id).to eq(2)
38
38
  end
39
39
 
40
40
  it "should not fetch an unknown object" do
41
- instance.child.should be_nil
41
+ expect(instance.child).to be_nil
42
42
  end
43
43
 
44
44
  it "should fetch an object known by id" do
45
45
  stub_json_request(:get, %r{test_resources/1/child/5}, json(:test_child => {:id => 5}))
46
46
  instance.child_id = 5
47
- instance.child.id.should == 5
47
+ expect(instance.child.id).to eq(5)
48
48
  end
49
49
 
50
50
  it "should handle client errors" do
@@ -56,65 +56,65 @@ describe ZendeskAPI::Association do
56
56
  it "should handle resource not found errors" do
57
57
  stub_request(:get, %r{test_resources/1/child/5}).to_return(:status => 404)
58
58
  instance.child_id = 5
59
- silence_logger{ instance.child.should be_nil }
59
+ silence_logger{ expect(instance.child).to be_nil }
60
60
  end
61
61
 
62
62
  it "is not used when not used" do
63
- instance.child_used?.should == false
63
+ expect(instance.child_used?).to eq(false)
64
64
  end
65
65
 
66
66
  it "is used when used" do
67
67
  instance.child = child
68
- instance.child_used?.should == true
68
+ expect(instance.child_used?).to eq(true)
69
69
  end
70
70
  end
71
71
 
72
72
  context "has_many" do
73
73
  it "should cache a set object" do
74
74
  instance.children = [child]
75
- instance.children.map(&:id).should == [1]
76
- instance.children.should be_instance_of(ZendeskAPI::Collection)
75
+ expect(instance.children.map(&:id)).to eq([1])
76
+ expect(instance.children).to be_instance_of(ZendeskAPI::Collection)
77
77
  end
78
78
 
79
79
  it "should set ids" do
80
80
  instance.children_ids = []
81
81
  instance.children = [child]
82
- instance.children_ids.should == [child.id]
83
- instance.children.should be_instance_of(ZendeskAPI::Collection)
82
+ expect(instance.children_ids).to eq([child.id])
83
+ expect(instance.children).to be_instance_of(ZendeskAPI::Collection)
84
84
  end
85
85
 
86
86
  it "should build and cache objects set via hash" do
87
87
  instance.children = [{:id => 2}]
88
- instance.children.map(&:id).should == [2]
89
- instance.children.should be_instance_of(ZendeskAPI::Collection)
88
+ expect(instance.children.map(&:id)).to eq([2])
89
+ expect(instance.children).to be_instance_of(ZendeskAPI::Collection)
90
90
  end
91
91
 
92
92
  it "should build a object set via id" do
93
93
  instance.children = [2]
94
- instance.children.map(&:id).should == [2]
95
- instance.children.should be_instance_of(ZendeskAPI::Collection)
94
+ expect(instance.children.map(&:id)).to eq([2])
95
+ expect(instance.children).to be_instance_of(ZendeskAPI::Collection)
96
96
  end
97
97
 
98
98
  it "should fetch unknown objects" do
99
99
  stub_json_request(:get, %r{test_resources/1/children}, json(:test_children => [{:id => 2}, {:id => 3}]))
100
- instance.children.map(&:id).should == [2,3]
101
- instance.children.should be_instance_of(ZendeskAPI::Collection)
100
+ expect(instance.children.map(&:id)).to eq([2,3])
101
+ expect(instance.children).to be_instance_of(ZendeskAPI::Collection)
102
102
  end
103
103
 
104
104
  it "should not change objects" do
105
105
  child = 'foo'
106
106
  children = [child]
107
107
  instance.children = children
108
- children[0].should == 'foo'
108
+ expect(children[0]).to eq('foo')
109
109
  end
110
110
 
111
111
  it "is not used when not used" do
112
- instance.children_used?.should == false
112
+ expect(instance.children_used?).to eq(false)
113
113
  end
114
114
 
115
115
  it "is used when used" do
116
116
  instance.children = [child]
117
- instance.children_used?.should == true
117
+ expect(instance.children_used?).to eq(true)
118
118
  end
119
119
  end
120
120
  end
@@ -123,23 +123,23 @@ describe ZendeskAPI::Association do
123
123
  subject { described_class.new(:class => ZendeskAPI::TestResource) }
124
124
 
125
125
  it "should generate resource path" do
126
- subject.generate_path.should == "test_resources"
126
+ expect(subject.generate_path).to eq("test_resources")
127
127
  end
128
128
 
129
129
  context "with an instance" do
130
130
  it "should generate a specific resource path" do
131
- subject.generate_path(instance).should == "test_resources/1"
131
+ expect(subject.generate_path(instance)).to eq("test_resources/1")
132
132
  end
133
133
 
134
134
  context "with_id => false" do
135
135
  it "should generate general resource path" do
136
- subject.generate_path(instance, :with_id => false).should == "test_resources"
136
+ expect(subject.generate_path(instance, :with_id => false)).to eq("test_resources")
137
137
  end
138
138
  end
139
139
 
140
140
  context "with an instance that is a new record" do
141
141
  it "should generate general resource path" do
142
- subject.generate_path(ZendeskAPI::TestResource.new(client)).should == "test_resources"
142
+ expect(subject.generate_path(ZendeskAPI::TestResource.new(client))).to eq("test_resources")
143
143
  end
144
144
  end
145
145
  end
@@ -148,15 +148,15 @@ describe ZendeskAPI::Association do
148
148
  before(:each) { subject.options[:path] = "blergh" }
149
149
 
150
150
  it "should generate general resource path" do
151
- subject.generate_path.should == "blergh"
151
+ expect(subject.generate_path).to eq("blergh")
152
152
  end
153
153
  end
154
154
 
155
155
  context "with a passed in id" do
156
156
  it "should generate specific resource path" do
157
157
  opts = { :id => 1 }
158
- subject.generate_path(opts).should == "test_resources/1"
159
- opts.should be_empty
158
+ expect(subject.generate_path(opts)).to eq("test_resources/1")
159
+ expect(opts).to be_empty
160
160
  end
161
161
  end
162
162
  end
@@ -165,17 +165,17 @@ describe ZendeskAPI::Association do
165
165
  subject { described_class.new(:class => ZendeskAPI::TestResource::TestChild, :parent => instance, :name => :children) }
166
166
 
167
167
  it "should generate nested resource path" do
168
- subject.generate_path.should == "test_resources/1/children"
168
+ expect(subject.generate_path).to eq("test_resources/1/children")
169
169
  end
170
170
 
171
171
  context "with an instance" do
172
172
  it "should generate a specific nested resource path" do
173
- subject.generate_path(child).should == "test_resources/1/children/1"
173
+ expect(subject.generate_path(child)).to eq("test_resources/1/children/1")
174
174
  end
175
175
 
176
176
  context "with_id => false" do
177
177
  it "should generate nested resource path" do
178
- subject.generate_path(child, :with_id => false).should == "test_resources/1/children"
178
+ expect(subject.generate_path(child, :with_id => false)).to eq("test_resources/1/children")
179
179
  end
180
180
  end
181
181
  end
@@ -184,7 +184,7 @@ describe ZendeskAPI::Association do
184
184
  before(:each) { subject.options[:path] = "blergh" }
185
185
 
186
186
  it "should generate nested resource path" do
187
- subject.generate_path.should == "test_resources/1/blergh"
187
+ expect(subject.generate_path).to eq("test_resources/1/blergh")
188
188
  end
189
189
  end
190
190
 
@@ -195,7 +195,7 @@ describe ZendeskAPI::Association do
195
195
  end
196
196
 
197
197
  it "should generate nested resource path" do
198
- subject.generate_path.should == "test_resources/1/blergh"
198
+ expect(subject.generate_path).to eq("test_resources/1/blergh")
199
199
  end
200
200
  end
201
201
 
@@ -205,7 +205,7 @@ describe ZendeskAPI::Association do
205
205
  end
206
206
 
207
207
  it "should generate nested resource path" do
208
- subject.generate_path.should == "test_resources/1/test_children"
208
+ expect(subject.generate_path).to eq("test_resources/1/test_children")
209
209
  end
210
210
  end
211
211
  end
@@ -218,14 +218,14 @@ describe ZendeskAPI::Association do
218
218
  end
219
219
 
220
220
  it "should generate specific nested resource path" do
221
- subject.generate_path(child).should == "test_resources/2/children/1"
221
+ expect(subject.generate_path(child)).to eq("test_resources/2/children/1")
222
222
  end
223
223
 
224
224
  context "with parent id passed in" do
225
225
  it "should generate nested resource path" do
226
226
  opts = { :test_resource_id => 3 }
227
- subject.generate_path(opts).should == "test_resources/3/children"
228
- opts.should be_empty
227
+ expect(subject.generate_path(opts)).to eq("test_resources/3/children")
228
+ expect(opts).to be_empty
229
229
  end
230
230
  end
231
231
  end
@@ -235,7 +235,7 @@ describe ZendeskAPI::Association do
235
235
 
236
236
  context "with an instance" do
237
237
  it "should not generate a specific resource path" do
238
- subject.generate_path(ZendeskAPI::SingularTestResource.new(client, :id => 1)).should == "singular_test_resources"
238
+ expect(subject.generate_path(ZendeskAPI::SingularTestResource.new(client, :id => 1))).to eq("singular_test_resources")
239
239
  end
240
240
  end
241
241
  end
@@ -49,11 +49,11 @@ describe ZendeskAPI::Client do
49
49
  end
50
50
 
51
51
  it "should build basic auth middleware" do
52
- subject.connection.builder.handlers.index(Faraday::Request::BasicAuthentication).should_not be_nil
52
+ expect(subject.connection.builder.handlers.index(Faraday::Request::BasicAuthentication)).to_not be_nil
53
53
  end
54
54
 
55
55
  it "should not build token middleware" do
56
- subject.connection.headers["Authorization"].should be_nil
56
+ expect(subject.connection.headers["Authorization"]).to be_nil
57
57
  end
58
58
  end
59
59
 
@@ -66,11 +66,11 @@ describe ZendeskAPI::Client do
66
66
  end
67
67
 
68
68
  it "should not build basic auth middleware" do
69
- subject.connection.builder.handlers.index(Faraday::Request::BasicAuthentication).should be_nil
69
+ expect(subject.connection.builder.handlers.index(Faraday::Request::BasicAuthentication)).to be_nil
70
70
  end
71
71
 
72
72
  it "should build token middleware" do
73
- subject.connection.headers["Authorization"].should match(/Bearer/)
73
+ expect(subject.connection.headers["Authorization"]).to match(/Bearer/)
74
74
  end
75
75
  end
76
76
 
@@ -90,25 +90,25 @@ describe ZendeskAPI::Client do
90
90
  let(:username) { "hello/token" }
91
91
 
92
92
  it "should not add /token to the username" do
93
- subject.username.should == "hello/token"
93
+ expect(subject.username).to eq("hello/token")
94
94
  end
95
95
  end
96
96
 
97
97
  context "with no password" do
98
98
  it "should build basic auth middleware" do
99
- client.connection.builder.handlers.index(Faraday::Request::BasicAuthentication).should_not be_nil
99
+ expect(client.connection.builder.handlers.index(Faraday::Request::BasicAuthentication)).to_not be_nil
100
100
  end
101
101
 
102
102
  it "should not build token middleware" do
103
- client.connection.builder.handlers.index(Faraday::Request::TokenAuthentication).should be_nil
103
+ expect(client.connection.builder.handlers.index(Faraday::Request::TokenAuthentication)).to be_nil
104
104
  end
105
105
 
106
106
  it "should copy token to password" do
107
- subject.token.should == subject.password
107
+ expect(subject.token).to eq(subject.password)
108
108
  end
109
109
 
110
110
  it "should add /token to the username" do
111
- subject.username.should == "hello/token"
111
+ expect(subject.username).to eq("hello/token")
112
112
  end
113
113
  end
114
114
  end
@@ -127,12 +127,12 @@ describe ZendeskAPI::Client do
127
127
  subject { true }
128
128
 
129
129
  it "should log in faraday" do
130
- @client.connection.builder.handlers.should include(ZendeskAPI::Middleware::Response::Logger)
130
+ expect(@client.connection.builder.handlers).to include(ZendeskAPI::Middleware::Response::Logger)
131
131
  end
132
132
 
133
133
  context "with a request" do
134
134
  it "should log" do
135
- client.config.logger.should_receive(:info).at_least(:once)
135
+ expect(client.config.logger).to receive(:info).at_least(:once)
136
136
  @client.connection.get('/bs')
137
137
  end
138
138
  end
@@ -142,7 +142,7 @@ describe ZendeskAPI::Client do
142
142
  subject { false }
143
143
 
144
144
  it "should not log" do
145
- @client.connection.builder.handlers.should_not include(ZendeskAPI::Middleware::Response::Logger)
145
+ expect(@client.connection.builder.handlers).to_not include(ZendeskAPI::Middleware::Response::Logger)
146
146
  end
147
147
  end
148
148
 
@@ -150,7 +150,7 @@ describe ZendeskAPI::Client do
150
150
  subject { nil }
151
151
 
152
152
  it "should log" do
153
- @client.connection.builder.handlers.should include(ZendeskAPI::Middleware::Response::Logger)
153
+ expect(@client.connection.builder.handlers).to include(ZendeskAPI::Middleware::Response::Logger)
154
154
  end
155
155
  end
156
156
 
@@ -159,12 +159,12 @@ describe ZendeskAPI::Client do
159
159
  subject { Logger.new(out) }
160
160
 
161
161
  it "should log" do
162
- @client.connection.builder.handlers.should include(ZendeskAPI::Middleware::Response::Logger)
162
+ expect(@client.connection.builder.handlers).to include(ZendeskAPI::Middleware::Response::Logger)
163
163
  end
164
164
 
165
165
  context "with a request" do
166
166
  it "should log to the subject" do
167
- out.should_receive(:write).at_least(:once)
167
+ expect(out).to receive(:write).at_least(:once)
168
168
  @client.connection.get('/bs')
169
169
  end
170
170
  end
@@ -178,49 +178,49 @@ describe ZendeskAPI::Client do
178
178
  end
179
179
 
180
180
  it "should be a user instance" do
181
- client.current_user.should be_instance_of(ZendeskAPI::User)
181
+ expect(client.current_user).to be_instance_of(ZendeskAPI::User)
182
182
  end
183
183
  end
184
184
 
185
185
  context "#connection" do
186
186
  it "should initially be false" do
187
- subject.instance_variable_get(:@connection).should be_false
187
+ expect(subject.instance_variable_get(:@connection)).to be_falsey
188
188
  end
189
189
 
190
190
  it "connection should be initialized on first call to #connection" do
191
- subject.connection.should be_instance_of(Faraday::Connection)
191
+ expect(subject.connection).to be_instance_of(Faraday::Connection)
192
192
  end
193
193
  end
194
194
 
195
195
  context "resources" do
196
196
  it "should return an instance of ZendeskAPI::Collection if there is no method" do
197
- subject.instance_variable_get(:@resource_cache)["tickets"].should be_nil
197
+ expect(subject.instance_variable_get(:@resource_cache)["tickets"]).to be_nil
198
198
 
199
- subject.tickets.should be_instance_of(ZendeskAPI::Collection)
199
+ expect(subject.tickets).to be_instance_of(ZendeskAPI::Collection)
200
200
 
201
- subject.instance_variable_get(:@resource_cache)["tickets"].should_not be_empty
202
- subject.instance_variable_get(:@resource_cache)["tickets"][:class].should == ZendeskAPI::Ticket
203
- subject.instance_variable_get(:@resource_cache)["tickets"][:cache].should be_instance_of(ZendeskAPI::LRUCache)
201
+ expect(subject.instance_variable_get(:@resource_cache)["tickets"]).to_not be_empty
202
+ expect(subject.instance_variable_get(:@resource_cache)["tickets"][:class]).to eq(ZendeskAPI::Ticket)
203
+ expect(subject.instance_variable_get(:@resource_cache)["tickets"][:cache]).to be_instance_of(ZendeskAPI::LRUCache)
204
204
 
205
- ZendeskAPI.should_not_receive(:const_get)
206
- subject.tickets.should be_instance_of(ZendeskAPI::Collection)
205
+ expect(ZendeskAPI).to_not receive(:const_get)
206
+ expect(subject.tickets).to be_instance_of(ZendeskAPI::Collection)
207
207
  end
208
208
 
209
209
  it "should not cache calls with different options" do
210
- subject.search(:query => 'abc').should_not == subject.search(:query => '123')
210
+ expect(subject.search(:query => 'abc')).to_not eq(subject.search(:query => '123'))
211
211
  end
212
212
 
213
213
  it "should not cache calls with :reload => true options" do
214
- subject.search(:query => 'abc').should_not == subject.search(:query => 'abc', :reload => true)
214
+ expect(subject.search(:query => 'abc')).to_not eq(subject.search(:query => 'abc', :reload => true))
215
215
  end
216
216
 
217
217
  it "should not pass reload to the underlying collection" do
218
218
  collection = subject.search(:query => 'abc', :reload => true)
219
- collection.options.key?(:reload).should be_false
219
+ expect(collection.options.key?(:reload)).to be(false)
220
220
  end
221
221
 
222
222
  it "should cache calls with the same options" do
223
- subject.search(:query => 'abc').should == subject.search(:query => 'abc')
223
+ expect(subject.search(:query => 'abc')).to eq(subject.search(:query => 'abc'))
224
224
  end
225
225
  end
226
226
 
@@ -228,22 +228,22 @@ describe ZendeskAPI::Client do
228
228
  client = SimpleClient.new do |config|
229
229
  config.allow_http = true
230
230
  end
231
- client.config.allow_http.should == true
232
- client.connection.should == "FOO"
233
- client.connection.object_id.should == client.connection.object_id # it's cached
231
+ expect(client.config.allow_http).to eq(true)
232
+ expect(client.connection).to eq("FOO")
233
+ expect(client.connection.object_id).to eq(client.connection.object_id) # it's cached
234
234
  end
235
235
 
236
236
  context ZendeskAPI::Voice do
237
237
  it "defers to voice delegator" do
238
- ZendeskAPI::Client.any_instance.should_receive(:phone_numbers).once
238
+ expect(subject).to receive(:phone_numbers).once
239
239
  subject.voice.phone_numbers
240
240
  end
241
241
 
242
242
  it "manages namespace correctly" do
243
- client.certification_addresses.path.should match(/channels\/voice\/certification_addresses/)
244
- client.phone_numbers.path.should match(/channels\/voice\/phone_numbers/)
245
- client.greetings.path.should match(/channels\/voice\/greetings/)
246
- client.greeting_categories.path.should match(/channels\/voice\/greeting_categories/)
243
+ expect(client.certification_addresses.path).to match(/channels\/voice\/certification_addresses/)
244
+ expect(client.phone_numbers.path).to match(/channels\/voice\/phone_numbers/)
245
+ expect(client.greetings.path).to match(/channels\/voice\/greetings/)
246
+ expect(client.greeting_categories.path).to match(/channels\/voice\/greeting_categories/)
247
247
  end
248
248
  end
249
249
  end