httpimagestore 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/bin/httpimagestore CHANGED
@@ -83,7 +83,9 @@ sinatra.put %r{/thumbnail/([^/]*)/(.*)} do |classes, image_path|
83
83
  urls << @s3.put_image(Pathname.new(image_path).thumbnail_image(image_hash, thumbnail_class.name).to_s, thumb.mime_type, thumb.data)
84
84
  end
85
85
 
86
- return urls.join("\n")
86
+ status 200
87
+ headers "Content-Type" => "text/uri-list"
88
+ body urls.map{|u| u + "\r\n"}.join
87
89
  end
88
90
 
89
91
  sinatra.error do
@@ -17,9 +17,16 @@ Feature: Original image and it's thumnails generation and storing on S2
17
17
  Scenario: Putting thumbnails and original to S3 bucket
18
18
  Given test.jpg file content as request body
19
19
  When I do PUT request http://localhost:3000/thumbnail/small,tiny/test/image/test.jpg
20
- Then I will get the following response body
20
+ Then response status will be 200
21
+ And response content type will be text/uri-list
22
+ And response body will be CRLF endend lines
21
23
  """
22
24
  http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test.jpg
23
25
  http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-small.jpg
24
26
  http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-tiny.jpg
27
+
25
28
  """
29
+ And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test.jpg will contain JPEG image of size 509x719
30
+ And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-small.jpg will contain JPEG image of size 128x128
31
+ And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-tiny.jpg will contain JPEG image of size 32x32
32
+
@@ -32,11 +32,26 @@ When /I do (.*) request (.*)/ do |method, uri|
32
32
  @response = HTTPClient.new.request(method, uri, nil, @request_body)
33
33
  end
34
34
 
35
- Then /I will get matching response body/ do |body|
36
- @response.body.should =~ Regexp.new(/^#{body}$/m)
35
+ Then /response status will be (.*)/ do |status|
36
+ @response.status.should == status.to_i
37
37
  end
38
38
 
39
- Then /I will get the following response body/ do |body|
40
- @response.body.should == body
39
+ Then /response content type will be (.*)/ do |content_type|
40
+ @response.header['Content-Type'].first.should == content_type
41
+ end
42
+
43
+ Then /response body will be CRLF endend lines/ do |body|
44
+ @response.body.should == body.gsub!("\n", "\r\n")
45
+ end
46
+
47
+ Then /(.*) will contain (.*) image of size (.*)/ do |url, image_type, image_size|
48
+ data = get(url)
49
+ Open3.popen3('identify -') do |stdin, stdout, stderr|
50
+ stdin.write data
51
+ stdin.close
52
+ path, type, size, *rest = *stdout.read.split(' ')
53
+ type.should == image_type
54
+ size.should == image_size
55
+ end
41
56
  end
42
57
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "httpimagestore"
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakub Pastuszek"]
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "features/httpimagestore.feature",
31
31
  "features/step_definitions/httpimagestore_steps.rb",
32
32
  "features/support/env.rb",
33
- "features/support/test.cfg",
34
33
  "features/support/test.jpg",
35
34
  "httpimagestore.gemspec",
36
35
  "lib/httpimagestore/configuration.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpimagestore
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jakub Pastuszek
@@ -223,7 +223,6 @@ files:
223
223
  - features/httpimagestore.feature
224
224
  - features/step_definitions/httpimagestore_steps.rb
225
225
  - features/support/env.rb
226
- - features/support/test.cfg
227
226
  - features/support/test.jpg
228
227
  - httpimagestore.gemspec
229
228
  - lib/httpimagestore/configuration.rb
@@ -1,6 +0,0 @@
1
- s3_key 'AKIAJMUYVYOSACNXLPTQ', 'MAeGhvW+clN7kzK3NboASf3/kZ6a81PRtvwMZj4Y'
2
- s3_bucket 'rhthumbnails'
3
-
4
- thumbnail_class 'small', 'crop', 128, 128
5
- thumbnail_class 'tiny', 'crop', 32, 32
6
-