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 CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- zendesk_api (1.0.1)
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.23)
65
+ mime-types (1.24)
66
66
  mongoid (3.1.4)
67
67
  activemodel (~> 3.2)
68
68
  moped (~> 1.4)
@@ -14,6 +14,10 @@ module ZendeskAPI
14
14
  @errors = {}
15
15
  end
16
16
  end
17
+
18
+ def to_s
19
+ "#{self.class.name}: #{@errors.to_s}"
20
+ end
17
21
  end
18
22
 
19
23
  class NetworkError < ClientError; end
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -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.1
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-16 00:00:00.000000000 Z
13
+ date: 2013-08-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bump