url2png-dc 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/url2png/cache.rb CHANGED
@@ -19,13 +19,13 @@ module Url2PngDc
19
19
  _json = JSON.parse(payload)
20
20
  _png = _json['png']
21
21
  _png if _png && !_png.empty?
22
+ rescue
23
+ nil
22
24
  end
23
25
 
24
26
  def request_to_url2png
25
27
  response = ::HTTParty.get(@url_2json_url)
26
28
  response.body
27
- rescue
28
- nil
29
29
  end
30
30
  end
31
31
  end
data/test/cache_test.rb CHANGED
@@ -30,7 +30,7 @@ module Url2PngDc
30
30
  assert_nil cache.url
31
31
  end
32
32
 
33
- def test_test_url_returns_nil_if_request_to_url2png_raises_anything
33
+ def test_url_returns_nil_if_request_to_url2png_raises_anything
34
34
  # mocky
35
35
  HTTParty.instance_eval do
36
36
  def get(url)
@@ -41,6 +41,13 @@ module Url2PngDc
41
41
  cache = Cache.new url_2json_url
42
42
  assert_nil cache.url
43
43
  end
44
+
45
+ def test_url_returns_nil_if_json_parse_raises_json_parse_error
46
+ mock_my_httparty! "this is not json..."
47
+
48
+ cache = Cache.new url_2json_url
49
+ assert_nil cache.url
50
+ end
44
51
  end
45
52
  end
46
53
 
data/url2png-dc.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "url2png-dc"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yung Hwa Kwon"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url2png-dc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: -611436617416580097
115
+ hash: 2977091029262403901
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements: