fake_aws 0.0.4 → 0.0.5

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: 97d179757822dc322dbb1546a8a009fdbdf58246
4
- data.tar.gz: 899598101f6b165db67453d1bd5a47166a6f2c02
3
+ metadata.gz: 202c6e531b7304c0c763d2d961f7cd39558365a3
4
+ data.tar.gz: de555c607a769593a7cb2ab58b522ea949fddc11
5
5
  SHA512:
6
- metadata.gz: 6d071767cae22f34d7b37e3a8a8b905897a836db641fcb7f67617a4c2364afffc65a16bcdcf3214464f553b2e2142494a70d5666b5f77b4c3ec18cf20d3dfc0f
7
- data.tar.gz: 1fe896cc79603bc19c15885ddfc028ab1045acc5dd2c6aa5ee21ab9189d8e98386a0752bc4efdab2d64b6be55d6ad8b2e493bbb0e8671748706991bef7dd350d
6
+ metadata.gz: cba9db5fc1b474cc3727f4bbbf55d7503d5d3fb883071031e9468cc9f2f497f99c7cd3a1bb8759b358f47e3549a082b0cb3342725536838731a8480c39480ac7
7
+ data.tar.gz: 87dde04297067c65ff0190970e49142b72d5e6ad94eb5d4f2bd352ad7dc9689df6921a3923af03e97172582404187f3e6d37be4c5760197c782269ad47d537a7
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
4
+ - 2.1.5
@@ -18,7 +18,7 @@ module FakeAWS
18
18
  private
19
19
 
20
20
  def success_response
21
- Responses::Success.new(headers, object_on_disk.read_content)
21
+ Responses::Success.new(object_on_disk.read_content, 200, headers)
22
22
  end
23
23
 
24
24
  def no_such_bucket_response
@@ -8,7 +8,7 @@ module FakeAWS
8
8
 
9
9
  def call(env)
10
10
  request = Request.new(env)
11
- operation_for(request).call.to_rack_response
11
+ operation_for(request).call
12
12
  end
13
13
 
14
14
  private
@@ -1,20 +1,14 @@
1
+ require 'rack/response'
2
+
1
3
  module FakeAWS
2
4
  module S3
3
5
  module Responses
4
6
 
5
- class Empty
7
+ class Empty < Rack::Response
6
8
  include Common
7
9
 
8
- def status_code
9
- 200
10
- end
11
-
12
- def headers
13
- common_headers
14
- end
15
-
16
- def body
17
- [""]
10
+ def initialize(status = 200, headers = {})
11
+ super([], status, common_headers.merge(headers))
18
12
  end
19
13
  end
20
14
 
@@ -1,24 +1,30 @@
1
+ require 'rack/response'
2
+
1
3
  module FakeAWS
2
4
  module S3
3
5
  module Responses
4
6
 
5
- class Error
7
+ class Error < Rack::Response
6
8
  include Common
7
9
 
8
10
  def initialize(error_code, fields = {})
9
11
  @error_code = error_code
10
12
  @fields = fields
13
+
14
+ super xml_payload, status_code, common_headers
11
15
  end
12
16
 
13
- def status_code
14
- error.status_code
17
+ private
18
+
19
+ def common_headers
20
+ super.merge("Content-Type" => "application/xml")
15
21
  end
16
22
 
17
- def headers
18
- @headers ||= common_headers.merge("Content-Type" => "application/xml")
23
+ def status_code
24
+ error.status_code
19
25
  end
20
26
 
21
- def body
27
+ def xml_payload
22
28
  "".tap do |xml|
23
29
  xml << %q{<?xml version="1.0" encoding="UTF-8"?>\n}
24
30
  xml << %q{<Error>}
@@ -1,25 +1,14 @@
1
+ require 'rack/response'
2
+
1
3
  module FakeAWS
2
4
  module S3
3
5
  module Responses
4
6
 
5
- class Success
7
+ class Success < Rack::Response
6
8
  include Common
7
9
 
8
- def initialize(headers, body)
9
- @headers = headers
10
- @body = body
11
- end
12
-
13
- def status_code
14
- 200
15
- end
16
-
17
- def headers
18
- common_headers.merge(@headers)
19
- end
20
-
21
- def body
22
- @body
10
+ def initialize(body, status, headers = {})
11
+ super body, status, common_headers.merge(headers)
23
12
  end
24
13
  end
25
14
 
@@ -1,3 +1,3 @@
1
1
  module FakeAWS
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -4,11 +4,11 @@ describe FakeAWS::S3::Responses::Empty do
4
4
  include_examples "common response headers"
5
5
 
6
6
  it "has a status code of 200" do
7
- expect(subject.status_code).to eq(200)
7
+ expect(subject).to be_ok
8
8
  end
9
9
 
10
10
  it "has an empty body" do
11
- expect(subject.body).to eq([''])
11
+ expect(subject).to be_empty
12
12
  end
13
13
 
14
14
  end
@@ -15,7 +15,7 @@ describe FakeAWS::S3::Responses::Error do
15
15
  include_examples "common response headers"
16
16
 
17
17
  it "has the right status code" do
18
- expect(subject.status_code).to eq(error.status_code)
18
+ expect(subject.status).to eq(error.status_code)
19
19
  end
20
20
 
21
21
  it "has a content type of XML" do
@@ -25,7 +25,7 @@ describe FakeAWS::S3::Responses::Error do
25
25
  context "body" do
26
26
  include XMLParsingHelper
27
27
 
28
- let(:parsed_body) { parse_xml(subject.body) }
28
+ let(:parsed_body) { parse_xml(subject.body.first) }
29
29
 
30
30
  it "contains the right code" do
31
31
  expect(parsed_body["Error"]["Code"]).to eq(error_code)
@@ -5,16 +5,16 @@ describe FakeAWS::S3::Responses::Success do
5
5
  let(:headers) { { "Content-Type" => "text/plain" } }
6
6
  let(:body) { "Hello, world!" }
7
7
 
8
- subject { described_class.new(headers, body) }
8
+ subject { described_class.new(body, 200, headers) }
9
9
 
10
10
  include_examples "common response headers"
11
11
 
12
12
  it "has a status code of 200" do
13
- expect(subject.status_code).to eq(200)
13
+ expect(subject).to be_ok
14
14
  end
15
15
 
16
16
  it "has the right body" do
17
- expect(subject.body).to eq(body)
17
+ expect(subject.body.first).to eq(body)
18
18
  end
19
19
 
20
20
  it "has the right content type" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Yandell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-16 00:00:00.000000000 Z
12
+ date: 2015-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: finer_struct
@@ -212,4 +212,3 @@ test_files:
212
212
  - spec/unit/s3/responses/empty_spec.rb
213
213
  - spec/unit/s3/responses/error_spec.rb
214
214
  - spec/unit/s3/responses/success_spec.rb
215
- has_rdoc: