zendesk_api 1.3.9 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -6,19 +6,19 @@ describe ZendeskAPI::Configuration do
6
6
  it "should properly merge options" do
7
7
  url = "test.host"
8
8
  subject.url = url
9
- subject.options[:url].should == url
9
+ expect(subject.options[:url]).to eq(url)
10
10
  end
11
11
 
12
12
  it "should set accept header properly" do
13
- subject.options[:headers][:accept].should == 'application/json'
13
+ expect(subject.options[:headers][:accept]).to eq('application/json')
14
14
  end
15
15
 
16
16
  it "should set user agent header properly" do
17
- subject.options[:headers][:user_agent].should =~ /ZendeskAPI API/
17
+ expect(subject.options[:headers][:user_agent]).to match(/ZendeskAPI API/)
18
18
  end
19
19
 
20
20
  it "should merge options with client_options" do
21
21
  subject.client_options = {:ssl => false}
22
- subject.options[:ssl].should == false
22
+ expect(subject.options[:ssl]).to eq(false)
23
23
  end
24
24
  end
@@ -10,7 +10,7 @@ describe ZendeskAPI::CreateResource do
10
10
  end
11
11
 
12
12
  it "should return instance of resource" do
13
- subject.create(client, attr).should be_instance_of(subject)
13
+ expect(subject.create(client, attr)).to be_instance_of(subject)
14
14
  end
15
15
 
16
16
  context "with client error" do
@@ -19,7 +19,7 @@ describe ZendeskAPI::CreateResource do
19
19
  end
20
20
 
21
21
  it "should handle it properly" do
22
- expect { silence_logger { subject.create(client, attr).should be_nil } }.to_not raise_error
22
+ expect { silence_logger { expect(subject.create(client, attr)).to be_nil } }.to_not raise_error
23
23
  end
24
24
  end
25
25
  end
@@ -2,14 +2,14 @@ require 'core/spec_helper'
2
2
 
3
3
  describe ZendeskAPI::DataResource do
4
4
  specify "singular resource name" do
5
- ZendeskAPI::Ticket.singular_resource_name.should == "ticket"
6
- ZendeskAPI::TicketField.singular_resource_name.should == "ticket_field"
5
+ expect(ZendeskAPI::Ticket.singular_resource_name).to eq("ticket")
6
+ expect(ZendeskAPI::TicketField.singular_resource_name).to eq("ticket_field")
7
7
  end
8
8
 
9
9
  specify "resource name" do
10
- ZendeskAPI::Ticket.resource_name.should == "tickets"
11
- ZendeskAPI::TicketField.resource_name.should == "ticket_fields"
12
- ZendeskAPI::Category.resource_name.should == "categories"
10
+ expect(ZendeskAPI::Ticket.resource_name).to eq("tickets")
11
+ expect(ZendeskAPI::TicketField.resource_name).to eq("ticket_fields")
12
+ expect(ZendeskAPI::Category.resource_name).to eq("categories")
13
13
  end
14
14
 
15
15
  context "association" do
@@ -23,7 +23,7 @@ describe ZendeskAPI::DataResource do
23
23
  it "should try and find non-existent object" do
24
24
  stub_json_request(:get, %r{test_resources/1/nil}, json(:nil_data_resource => {}))
25
25
 
26
- subject.nil.should be_instance_of(ZendeskAPI::NilDataResource)
26
+ expect(subject.nil).to be_instance_of(ZendeskAPI::NilDataResource)
27
27
  end
28
28
 
29
29
  context "inline => true" do
@@ -41,7 +41,7 @@ describe ZendeskAPI::DataResource do
41
41
  before(:each) { subject.attributes[:priority] = "normal" }
42
42
 
43
43
  it "should be able to access underlying attributes" do
44
- subject.priority.should == "normal"
44
+ expect(subject.priority).to eq("normal")
45
45
  end
46
46
 
47
47
  it "should be able to change underlying attributes" do
@@ -62,7 +62,7 @@ describe ZendeskAPI::DataResource do
62
62
  before(:each) { subject.priority = "normal" }
63
63
 
64
64
  it "should be able to change underlying attributes" do
65
- subject.priority.should == "normal"
65
+ expect(subject.priority).to eq("normal")
66
66
  end
67
67
 
68
68
  it "should be able to change underlying attributes" do
@@ -86,14 +86,14 @@ describe ZendeskAPI::DataResource do
86
86
  subject { ZendeskAPI::TestResource }
87
87
 
88
88
  it "should define a method with the same name" do
89
- subject.instance_methods.map(&:to_s).should include("test_resource")
89
+ expect(subject.instance_methods.map(&:to_s)).to include("test_resource")
90
90
  end
91
91
 
92
92
  context "with explicit class name" do
93
93
  before(:all) { ZendeskAPI::TestResource.has :baz, :class => ZendeskAPI::TestResource }
94
94
 
95
95
  it "should define a method with the same name" do
96
- subject.instance_methods.map(&:to_s).should include("baz")
96
+ expect(subject.instance_methods.map(&:to_s)).to include("baz")
97
97
  end
98
98
  end
99
99
  end
@@ -104,18 +104,18 @@ describe ZendeskAPI::DataResource do
104
104
  before(:each) { stub_json_request(:get, %r{test_resources/\d+}, json(:test_resource => {})) }
105
105
 
106
106
  it "should attempt to grab the resource from the host" do
107
- subject.test_resource.should be_instance_of(ZendeskAPI::TestResource)
107
+ expect(subject.test_resource).to be_instance_of(ZendeskAPI::TestResource)
108
108
  end
109
109
 
110
110
  it "should pass the path on to the resource" do
111
- subject.test_resource.path.should == "test_resources"
111
+ expect(subject.test_resource.path).to eq("test_resources")
112
112
  end
113
113
 
114
114
  context "with a client error" do
115
115
  before(:each) { stub_request(:get, %r{test_resources/\d+}).to_return(:status => 500) }
116
116
 
117
117
  it "should handle it properly" do
118
- expect { silence_logger{ subject.test_resource.should be_nil } }.to_not raise_error
118
+ expect { silence_logger{ expect(subject.test_resource).to be_nil } }.to_not raise_error
119
119
  end
120
120
  end
121
121
 
@@ -126,7 +126,7 @@ describe ZendeskAPI::DataResource do
126
126
  end
127
127
 
128
128
  it "should call the right path" do
129
- subject.test_resource.should be_instance_of(ZendeskAPI::TestResource)
129
+ expect(subject.test_resource).to be_instance_of(ZendeskAPI::TestResource)
130
130
  end
131
131
  end
132
132
  end
@@ -136,11 +136,11 @@ describe ZendeskAPI::DataResource do
136
136
  subject { ZendeskAPI::TestResource.new(client, :test_resource => test_resource).test_resource }
137
137
 
138
138
  it "should load the correct instance" do
139
- subject.should be_instance_of(ZendeskAPI::TestResource)
139
+ expect(subject).to be_instance_of(ZendeskAPI::TestResource)
140
140
  end
141
141
 
142
142
  it "should load foo from the hash" do
143
- subject.message.should == "FOO_OBJ"
143
+ expect(subject.message).to eq("FOO_OBJ")
144
144
  end
145
145
  end
146
146
 
@@ -155,8 +155,8 @@ describe ZendeskAPI::DataResource do
155
155
  end
156
156
 
157
157
  it "should handle nil response from find api" do
158
- ZendeskAPI::TestResource.should_receive(:find).twice.and_return(nil)
159
- subject.test_resource.should be_nil
158
+ expect(ZendeskAPI::TestResource).to receive(:find).twice.and_return(nil)
159
+ expect(subject.test_resource).to be_nil
160
160
  subject.test_resource
161
161
  end
162
162
  end
@@ -170,14 +170,14 @@ describe ZendeskAPI::DataResource do
170
170
  subject { ZendeskAPI::TestResource }
171
171
 
172
172
  it "should define a method with the same name" do
173
- subject.instance_methods.map(&:to_s).should include("test_resources")
173
+ expect(subject.instance_methods.map(&:to_s)).to include("test_resources")
174
174
  end
175
175
 
176
176
  context "with explicit class name" do
177
177
  before(:each) { ZendeskAPI::TestResource.has_many :cats, :class => ZendeskAPI::TestResource }
178
178
 
179
179
  it "should define a method with the same name" do
180
- subject.instance_methods.map(&:to_s).should include("cats")
180
+ expect(subject.instance_methods.map(&:to_s)).to include("cats")
181
181
  end
182
182
  end
183
183
  end
@@ -187,11 +187,11 @@ describe ZendeskAPI::DataResource do
187
187
  subject { ZendeskAPI::TestResource.new(client, :id => 1) }
188
188
 
189
189
  it "should not attempt to grab the resource from the host" do
190
- subject.test_resources.should be_instance_of(ZendeskAPI::Collection)
190
+ expect(subject.test_resources).to be_instance_of(ZendeskAPI::Collection)
191
191
  end
192
192
 
193
193
  it "should pass the path on to the resource" do
194
- subject.test_resources.path.should == "test_resources/1/test_resources"
194
+ expect(subject.test_resources.path).to eq("test_resources/1/test_resources")
195
195
  end
196
196
 
197
197
  context "with an explicit path set" do
@@ -200,7 +200,7 @@ describe ZendeskAPI::DataResource do
200
200
  end
201
201
 
202
202
  it "should call the right path" do
203
- subject.test_resources.path.should == "test_resources/1/blargh"
203
+ expect(subject.test_resources.path).to eq("test_resources/1/blargh")
204
204
  end
205
205
  end
206
206
  end
@@ -210,11 +210,11 @@ describe ZendeskAPI::DataResource do
210
210
  subject { ZendeskAPI::TestResource.new(client, :test_resources => test_resources).test_resources.first }
211
211
 
212
212
  it "should properly create instance" do
213
- subject.message.should == "FOO_OBJ"
213
+ expect(subject.message).to eq("FOO_OBJ")
214
214
  end
215
215
 
216
216
  it "should map bars onto TestResource class" do
217
- subject.should be_instance_of(ZendeskAPI::TestResource)
217
+ expect(subject).to be_instance_of(ZendeskAPI::TestResource)
218
218
  end
219
219
  end
220
220
 
@@ -223,13 +223,13 @@ describe ZendeskAPI::DataResource do
223
223
  subject { ZendeskAPI::TestResource.new(client, :test_resource_ids => test_resource_ids) }
224
224
 
225
225
  it "should find foo_id and load it from the api" do
226
- ZendeskAPI::TestResource.should_receive(:find).with(client, kind_of(Hash)).exactly(test_resource_ids.length).times
226
+ expect(ZendeskAPI::TestResource).to receive(:find).with(client, kind_of(Hash)).exactly(test_resource_ids.length).times
227
227
  subject.test_resources
228
228
  end
229
229
 
230
230
  it "should handle nil response from find api" do
231
- ZendeskAPI::TestResource.should_receive(:find).with(client, kind_of(Hash)).exactly(test_resource_ids.length).times.and_return(nil)
232
- subject.test_resources.should be_empty
231
+ expect(ZendeskAPI::TestResource).to receive(:find).with(client, kind_of(Hash)).exactly(test_resource_ids.length).times.and_return(nil)
232
+ expect(subject.test_resources).to be_empty
233
233
  subject.test_resources # Test expectations
234
234
  end
235
235
  end
@@ -2,6 +2,6 @@ require 'core/spec_helper'
2
2
 
3
3
  describe String do
4
4
  specify "the plural of forum if forums" do
5
- Inflection.plural("forum").should == "forums"
5
+ expect(Inflection.plural("forum")).to eq("forums")
6
6
  end
7
7
  end
@@ -4,8 +4,8 @@ describe ZendeskAPI::LRUCache do
4
4
  let(:cache){ ZendeskAPI::LRUCache.new(2) }
5
5
 
6
6
  it "writes and reads" do
7
- cache.write("x", 1).should == 1
8
- cache.read("x").should == 1
7
+ expect(cache.write("x", 1)).to eq(1)
8
+ expect(cache.read("x")).to eq(1)
9
9
  end
10
10
 
11
11
  it "drops" do
@@ -13,14 +13,14 @@ describe ZendeskAPI::LRUCache do
13
13
  cache.write("y", 1)
14
14
  cache.write("x", 1)
15
15
  cache.write("z", 1)
16
- cache.read("z").should == 1
17
- cache.read("x").should == 1
18
- cache.read("y").should == nil
16
+ expect(cache.read("z")).to eq(1)
17
+ expect(cache.read("x")).to eq(1)
18
+ expect(cache.read("y")).to eq(nil)
19
19
  end
20
20
 
21
21
  it "fetches" do
22
- cache.fetch("x"){ 1 }.should == 1
23
- cache.read("x").should == 1
24
- cache.fetch("x"){ 2 }.should == 1
22
+ expect(cache.fetch("x"){ 1 }).to eq(1)
23
+ expect(cache.read("x")).to eq(1)
24
+ expect(cache.fetch("x"){ 2 }).to eq(1)
25
25
  end
26
26
  end
@@ -11,7 +11,7 @@ describe ZendeskAPI::Middleware::Request::EncodeJson do
11
11
  let(:env) {{ :body => nil }}
12
12
 
13
13
  it 'should not return json' do
14
- response[:body].should be_nil
14
+ expect(response[:body]).to be_nil
15
15
  end
16
16
  end
17
17
 
@@ -19,7 +19,7 @@ describe ZendeskAPI::Middleware::Request::EncodeJson do
19
19
  let(:env) {{ :body => '' }}
20
20
 
21
21
  it 'should not return json' do
22
- response[:body].should == ''
22
+ expect(response[:body]).to eq('')
23
23
  end
24
24
  end
25
25
 
@@ -28,11 +28,11 @@ describe ZendeskAPI::Middleware::Request::EncodeJson do
28
28
  let(:env) {{ :body => { :a => :b } }}
29
29
 
30
30
  it 'encodes json' do
31
- response[:body].should == JSON.dump(:a => :b)
31
+ expect(response[:body]).to eq(JSON.dump(:a => :b))
32
32
  end
33
33
 
34
34
  it 'sets the content type' do
35
- response[:request_headers]['Content-Type'].should == 'application/json'
35
+ expect(response[:request_headers]['Content-Type']).to eq('application/json')
36
36
  end
37
37
  end
38
38
 
@@ -45,11 +45,11 @@ describe ZendeskAPI::Middleware::Request::EncodeJson do
45
45
  }}
46
46
 
47
47
  it 'encodes json' do
48
- response[:body].should == JSON.dump(:a => :b)
48
+ expect(response[:body]).to eq(JSON.dump(:a => :b))
49
49
  end
50
50
 
51
51
  it 'keeps the content type' do
52
- response[:request_headers]['Content-Type'].should == 'application/json'
52
+ expect(response[:request_headers]['Content-Type']).to eq('application/json')
53
53
  end
54
54
  end
55
55
 
@@ -62,11 +62,11 @@ describe ZendeskAPI::Middleware::Request::EncodeJson do
62
62
  }}
63
63
 
64
64
  it 'encodes json' do
65
- response[:body].should == JSON.dump(:a => :b)
65
+ expect(response[:body]).to eq(JSON.dump(:a => :b))
66
66
  end
67
67
 
68
68
  it 'keeps the content type' do
69
- response[:request_headers]['Content-Type'].should == 'application/json; encoding=utf-8'
69
+ expect(response[:request_headers]['Content-Type']).to eq('application/json; encoding=utf-8')
70
70
  end
71
71
  end
72
72
  end
@@ -6,16 +6,16 @@ describe ZendeskAPI::Middleware::Request::EtagCache do
6
6
 
7
7
  stub_json_request(:get, %r{blergh}, '{"x":1}', :headers => {"Etag" => "x"})
8
8
  first_response = client.connection.get("blergh")
9
- first_response.status.should == 200
10
- first_response.body.should == {"x"=>1}
9
+ expect(first_response.status).to eq(200)
10
+ expect(first_response.body).to eq({"x"=>1})
11
11
 
12
12
  stub_request(:get, %r{blergh}).to_return(:status => 304, :headers => {"Etag" => "x"})
13
13
  response = client.connection.get("blergh")
14
- response.status.should == 304
15
- response.body.should == {"x"=>1}
14
+ expect(response.status).to eq(304)
15
+ expect(response.body).to eq({"x"=>1})
16
16
 
17
17
  %w{content_encoding content_type content_length etag}.each do |header|
18
- response.headers[header].should == first_response.headers[header]
18
+ expect(response.headers[header]).to eq(first_response.headers[header])
19
19
  end
20
20
  end
21
21
  end
@@ -13,9 +13,11 @@ describe ZendeskAPI::Middleware::Request::Retry do
13
13
  to_return(:status => 429, :headers => { :retry_after => 1 }).
14
14
  to_return(:status => 200)
15
15
 
16
- runtime do
17
- client.connection.get("blergh").status.should == 200
18
- end.should be_within(0.2).of(1)
16
+ seconds = runtime {
17
+ expect(client.connection.get("blergh").status).to eq(200)
18
+ }
19
+
20
+ expect(seconds).to be_within(0.2).of(1)
19
21
  end
20
22
  end
21
23
 
@@ -25,17 +27,17 @@ describe ZendeskAPI::Middleware::Request::Retry do
25
27
  to_return(:status => 503).
26
28
  to_return(:status => 200)
27
29
 
28
- ZendeskAPI::Middleware::Request::Retry.any_instance.should_receive(:sleep).exactly(10).times.with(1)
30
+ expect_any_instance_of(ZendeskAPI::Middleware::Request::Retry).to receive(:sleep).exactly(10).times.with(1)
29
31
  end
30
32
 
31
33
  it "should wait default timeout seconds and then retry request on error" do
32
- runtime do
33
- client.connection.get("blergh").status.should == 200
34
- end.should <= 0.5
34
+ expect(runtime {
35
+ expect(client.connection.get("blergh").status).to eq(200)
36
+ }).to be <= 0.5
35
37
  end
36
38
 
37
39
  it "should print to logger" do
38
- client.config.logger.should_receive(:warn).at_least(:once)
40
+ expect(client.config.logger).to receive(:warn).at_least(:once)
39
41
  client.connection.get("blergh")
40
42
  end
41
43
 
@@ -7,15 +7,15 @@ describe ZendeskAPI::Middleware::Request::Upload do
7
7
  let(:filename) { File.join(File.dirname(__FILE__), "test.jpg") }
8
8
 
9
9
  it "should handle no body" do
10
- subject.call({}).should == {}
10
+ expect(subject.call({})).to eq({})
11
11
  end
12
12
 
13
13
  it "should handle body with no file" do
14
- subject.call(:body => {})[:body].should == {}
14
+ expect(subject.call(:body => {})[:body]).to eq({})
15
15
  end
16
16
 
17
17
  it "should handle invalid types" do
18
- subject.call(:body => { :file => :invalid })[:body].should == {}
18
+ expect(subject.call(:body => { :file => :invalid })[:body]).to eq({})
19
19
  end
20
20
 
21
21
  context "with file string" do
@@ -24,15 +24,15 @@ describe ZendeskAPI::Middleware::Request::Upload do
24
24
  end
25
25
 
26
26
  it "should convert file string to UploadIO" do
27
- @env[:body][:uploaded_data].should be_instance_of(Faraday::UploadIO)
27
+ expect(@env[:body][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
28
28
  end
29
29
 
30
30
  it "should remove file string" do
31
- @env[:body][:file].should be_nil
31
+ expect(@env[:body][:file]).to be_nil
32
32
  end
33
33
 
34
34
  it "should add filename if none exist" do
35
- @env[:body][:filename].should == "test.jpg"
35
+ expect(@env[:body][:filename]).to eq("test.jpg")
36
36
  end
37
37
 
38
38
  context "with filename" do
@@ -41,7 +41,7 @@ describe ZendeskAPI::Middleware::Request::Upload do
41
41
  end
42
42
 
43
43
  it "should not change filename" do
44
- @env[:body][:filename].should_not == "test.jpg"
44
+ expect(@env[:body][:filename]).to_not eq("test.jpg")
45
45
  end
46
46
  end
47
47
  end
@@ -53,32 +53,32 @@ describe ZendeskAPI::Middleware::Request::Upload do
53
53
  end
54
54
 
55
55
  it "should convert file string to UploadIO" do
56
- @env[:body][:uploaded_data].should be_instance_of(Faraday::UploadIO)
56
+ expect(@env[:body][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
57
57
  end
58
58
 
59
59
  it "should remove file string" do
60
- @env[:body][:file].should be_nil
60
+ expect(@env[:body][:file]).to be_nil
61
61
  end
62
62
 
63
63
  it "should add filename if none exist" do
64
- @env[:body][:filename].should == "hello.jpg"
64
+ expect(@env[:body][:filename]).to eq("hello.jpg")
65
65
  end
66
66
 
67
67
  it "should use the content type of the tempfile" do
68
- @env[:body][:uploaded_data].content_type.should == "image/jpeg"
68
+ expect(@env[:body][:uploaded_data].content_type).to eq("image/jpeg")
69
69
  end
70
70
 
71
71
  context "when path does not resolve a mime_type" do
72
72
  it "should pass correct filename to Faraday::UploadIO" do
73
- @env[:body][:filename].should == "hello.jpg"
74
- @env[:body][:uploaded_data].original_filename.should == @env[:body][:filename]
73
+ expect(@env[:body][:filename]).to eq("hello.jpg")
74
+ expect(@env[:body][:uploaded_data].original_filename).to eq(@env[:body][:filename])
75
75
  end
76
76
 
77
77
  it "should use the content_type of ActionDispatch::Http::UploadedFile " do
78
78
  @upload.content_type = 'application/random'
79
79
 
80
80
  env = subject.call(:body => { :file => @upload })
81
- env[:body][:uploaded_data].content_type.should == 'application/random'
81
+ expect(env[:body][:uploaded_data].content_type).to eq('application/random')
82
82
  end
83
83
  end
84
84
  end
@@ -90,15 +90,15 @@ describe ZendeskAPI::Middleware::Request::Upload do
90
90
  end
91
91
 
92
92
  it "should convert file string to UploadIO" do
93
- @env[:body][:uploaded_data].should be_instance_of(Faraday::UploadIO)
93
+ expect(@env[:body][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
94
94
  end
95
95
 
96
96
  it "should remove file string" do
97
- @env[:body][:file].should be_nil
97
+ expect(@env[:body][:file]).to be_nil
98
98
  end
99
99
 
100
100
  it "should add filename if none exist" do
101
- @env[:body][:filename].should == File.basename(@tempfile.path)
101
+ expect(@env[:body][:filename]).to eq(File.basename(@tempfile.path))
102
102
  end
103
103
  end
104
104
 
@@ -109,15 +109,15 @@ describe ZendeskAPI::Middleware::Request::Upload do
109
109
  end
110
110
 
111
111
  it "should convert file string to UploadIO" do
112
- @env[:body][:uploaded_data].should be_instance_of(Faraday::UploadIO)
112
+ expect(@env[:body][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
113
113
  end
114
114
 
115
115
  it "should remove file string" do
116
- @env[:body][:file].should be_nil
116
+ expect(@env[:body][:file]).to be_nil
117
117
  end
118
118
 
119
119
  it "should add filename if none exist" do
120
- @env[:body][:filename].should == "test.jpg"
120
+ expect(@env[:body][:filename]).to eq("test.jpg")
121
121
  end
122
122
 
123
123
  context "with filename" do
@@ -126,7 +126,7 @@ describe ZendeskAPI::Middleware::Request::Upload do
126
126
  end
127
127
 
128
128
  it "should not change filename" do
129
- @env[:body][:filename].should_not == "test.jpg"
129
+ expect(@env[:body][:filename]).to_not eq("test.jpg")
130
130
  end
131
131
  end
132
132
  end
@@ -138,11 +138,11 @@ describe ZendeskAPI::Middleware::Request::Upload do
138
138
  end
139
139
 
140
140
  it "should convert file string to UploadIO" do
141
- @env[:body][:user][:photo][:uploaded_data].should be_instance_of(Faraday::UploadIO)
141
+ expect(@env[:body][:user][:photo][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
142
142
  end
143
143
 
144
144
  it "should add filename if none exist" do
145
- @env[:body][:user][:photo][:filename].should == "test.jpg"
145
+ expect(@env[:body][:user][:photo][:filename]).to eq("test.jpg")
146
146
  end
147
147
  end
148
148
 
@@ -152,11 +152,11 @@ describe ZendeskAPI::Middleware::Request::Upload do
152
152
  end
153
153
 
154
154
  it "should convert file string to UploadIO" do
155
- @env[:body][:user][:photo][:uploaded_data].should be_instance_of(Faraday::UploadIO)
155
+ expect(@env[:body][:user][:photo][:uploaded_data]).to be_instance_of(Faraday::UploadIO)
156
156
  end
157
157
 
158
158
  it "should not change filename" do
159
- @env[:body][:user][:photo][:filename].should_not == "test.jpg"
159
+ expect(@env[:body][:user][:photo][:filename]).to_not eq("test.jpg")
160
160
  end
161
161
  end
162
162
  end