fastimage_resize 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 3
2
+ :patch: 4
3
3
  :major: 1
4
4
  :build:
5
5
  :minor: 2
@@ -50,8 +50,8 @@ class FastImage
50
50
  else
51
51
  resize_local(uri_in, file_out, w, h, jpeg_quality)
52
52
  end
53
- rescue OpenURI::HTTPError, SocketError
54
- raise ImageFetchFailure
53
+ rescue OpenURI::HTTPError, SocketError, URI::InvalidURIError, RuntimeError => e
54
+ raise ImageFetchFailure, e.class
55
55
  end
56
56
 
57
57
  def self.resize_local(file_in, file_out, w, h, jpeg_quality)
data/test/test.rb CHANGED
@@ -4,7 +4,7 @@ require 'test/unit'
4
4
 
5
5
  PathHere = File.dirname(__FILE__)
6
6
 
7
- require File.join(PathHere, "..", "lib", 'fastimage_resize')
7
+ require File.join(".", PathHere, "..", "lib", 'fastimage_resize')
8
8
 
9
9
  require 'fakeweb'
10
10
 
@@ -22,7 +22,7 @@ BadFixtures = [
22
22
  "test.ico"
23
23
  ]
24
24
 
25
- TestUrl = "http://example.nowhere/"
25
+ TestUrl = "http://www.example.nowhere/"
26
26
 
27
27
  GoodFixtures.each do |fn, info|
28
28
  FakeWeb.register_uri(:get, "#{TestUrl}#{fn}", :body => File.join(FixturePath, fn))
@@ -31,6 +31,15 @@ BadFixtures.each do |fn|
31
31
  FakeWeb.register_uri(:get, "#{TestUrl}#{fn}", :body => File.join(FixturePath, fn))
32
32
  end
33
33
 
34
+ redirect_response = <<END
35
+ HTTP/1.1 302 Found
36
+ Date: Tue, 27 Sep 2011 09:47:50 GMT
37
+ Server: Apache/2.2.11
38
+ Location: https://somwehere.example.com/a.gif
39
+ Status: 302
40
+ END
41
+ FakeWeb.register_uri(:get, "#{TestUrl}/redirect", :response=>redirect_response)
42
+
34
43
  class FastImageResizeTest < Test::Unit::TestCase
35
44
  def test_resize_image_types
36
45
  GoodFixtures.each do |fn, info|
@@ -65,4 +74,15 @@ class FastImageResizeTest < Test::Unit::TestCase
65
74
  end
66
75
  end
67
76
 
77
+ def test_should_raise_for_invalid_uri
78
+ assert_raises(FastImage::ImageFetchFailure) do
79
+ FastImage.resize("#{TestUrl}////%&redirect", "foo", 20, 20)
80
+ end
81
+ end
82
+
83
+ def test_should_raise_for_redirect
84
+ assert_raises(FastImage::ImageFetchFailure) do
85
+ FastImage.resize("#{TestUrl}/redirect", "foo", 20, 20)
86
+ end
87
+ end
68
88
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastimage_resize
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 2
8
- - 3
9
- version: 1.2.3
9
+ - 4
10
+ version: 1.2.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Stephen Sykes
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-25 00:00:00 +03:00
18
+ date: 2011-09-27 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: RubyInline
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 35
27
30
  segments:
28
31
  - 3
29
32
  - 8
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: fastimage
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 31
41
46
  segments:
42
47
  - 1
43
48
  - 2
@@ -77,23 +82,27 @@ rdoc_options:
77
82
  require_paths:
78
83
  - lib
79
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
80
86
  requirements:
81
87
  - - ">="
82
88
  - !ruby/object:Gem::Version
89
+ hash: 3
83
90
  segments:
84
91
  - 0
85
92
  version: "0"
86
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
87
95
  requirements:
88
96
  - - ">="
89
97
  - !ruby/object:Gem::Version
98
+ hash: 3
90
99
  segments:
91
100
  - 0
92
101
  version: "0"
93
102
  requirements:
94
103
  - libgd, see www.libgd.org
95
104
  rubyforge_project:
96
- rubygems_version: 1.3.6
105
+ rubygems_version: 1.3.7
97
106
  signing_key:
98
107
  specification_version: 3
99
108
  summary: FastImage Resize - Image resizing fast and simple