telize 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d66d599d17bef239d5b9faec14b9088f35897a66
4
- data.tar.gz: 3dde32a9d8adb5bb41341d9775bf5b13bd74b6e9
3
+ metadata.gz: 3e67d6f4f0c7c6a834e2f66aec41a285022d0478
4
+ data.tar.gz: aed6eadcfa98461743c2b7bfa496cd35f5fd3155
5
5
  SHA512:
6
- metadata.gz: d1be8bcb4335c85dc91a850df1dcefef96bff73c3a90b7946e6edf32f7a6c216fe9460883d0443e02461296204993531cc2a857622b433605c315c7e02a899ce
7
- data.tar.gz: b4dd4177cc8cb497832110160a8218989d2fd6b39c636fbf74a72b808060084e368fc601ffe564b471a6cb63f7663228eb0542d19a85b429809c19c3c89f6ad6
6
+ metadata.gz: 55dd32d489ab0efaae87e7d05ab3880ab7d699be22ab7f62e288407e8516a7ccd2b4625c7070cd064583b75e450e07bdb420eb99f9f29f29e09107322e1e5288
7
+ data.tar.gz: 531f9a78cfa59320aaa7d6cb9ebf128bcf685ca8bcbd59116d98ec9aaded7fd86956a12dd85d35e00fb9ffc1c8f280301cbfb65fca9413d5c610990e52f105f4
@@ -41,7 +41,7 @@ module Telize
41
41
 
42
42
  def decode_body(body)
43
43
  MultiJson.load(body)
44
- ensure
44
+ rescue MultiJson::ParseError => _
45
45
  {}
46
46
  end
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module Telize
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -120,5 +120,18 @@ RSpec.describe Telize do
120
120
 
121
121
  it { is_expected.to eq({}) }
122
122
  end
123
+
124
+ context 'when bad json is given' do
125
+ let(:response) { '{":"bla bla bla"' }
126
+
127
+ subject { Telize.geoip }
128
+
129
+ before do
130
+ stub_request(:get, 'http://www.telize.com/geoip').
131
+ to_return(status: 200, body: response, headers: { 'Content-Type' => 'application/json' })
132
+ end
133
+
134
+ it { is_expected.to eq({}) }
135
+ end
123
136
  end
124
137
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - undr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json