zendesk_api 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/lib/zendesk_api/error.rb +4 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/middleware/response/raise_error_spec.rb +19 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
zendesk_api (1.0.
|
10
|
+
zendesk_api (1.0.2)
|
11
11
|
faraday (>= 0.8.0)
|
12
12
|
faraday_middleware (>= 0.8.7)
|
13
13
|
hashie (>= 1.2)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
jruby-openssl (0.8.8)
|
63
63
|
bouncy-castle-java (>= 1.5.0147)
|
64
64
|
json (1.8.0)
|
65
|
-
mime-types (1.
|
65
|
+
mime-types (1.24)
|
66
66
|
mongoid (3.1.4)
|
67
67
|
activemodel (~> 3.2)
|
68
68
|
moped (~> 1.4)
|
data/lib/zendesk_api/error.rb
CHANGED
data/lib/zendesk_api/version.rb
CHANGED
@@ -24,8 +24,11 @@ describe ZendeskAPI::Middleware::Response::RaiseError do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
context "status errors" do
|
27
|
+
let(:body) { "" }
|
28
|
+
|
27
29
|
before(:each) do
|
28
|
-
stub_request(:any, /.*/).to_return(:status => status
|
30
|
+
stub_request(:any, /.*/).to_return(:status => status, :body => body,
|
31
|
+
:headers => { :content_type => "application/json" })
|
29
32
|
end
|
30
33
|
|
31
34
|
context "with status = 404" do
|
@@ -50,6 +53,21 @@ describe ZendeskAPI::Middleware::Response::RaiseError do
|
|
50
53
|
it "should raise RecordInvalid" do
|
51
54
|
expect { client.connection.get "/non_existent" }.to raise_error(ZendeskAPI::Error::RecordInvalid)
|
52
55
|
end
|
56
|
+
|
57
|
+
context "with a body" do
|
58
|
+
let(:body) { MultiJson.dump(:details => "hello") }
|
59
|
+
|
60
|
+
it "should return RecordInvalid with proper message" do
|
61
|
+
begin
|
62
|
+
client.connection.get "/non_existent"
|
63
|
+
rescue ZendeskAPI::Error::RecordInvalid => e
|
64
|
+
e.errors.should == "hello"
|
65
|
+
e.to_s.should == "ZendeskAPI::Error::RecordInvalid: hello"
|
66
|
+
else
|
67
|
+
fail # didn't raise an error
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
53
71
|
end
|
54
72
|
|
55
73
|
context "with status = 200" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-08-
|
13
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bump
|