fake_aws 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/lib/fake_aws/s3/operations/get_object.rb +1 -1
- data/lib/fake_aws/s3/rack_app.rb +1 -1
- data/lib/fake_aws/s3/responses/empty.rb +5 -11
- data/lib/fake_aws/s3/responses/error.rb +12 -6
- data/lib/fake_aws/s3/responses/success.rb +5 -16
- data/lib/fake_aws/version.rb +1 -1
- data/spec/unit/s3/responses/empty_spec.rb +2 -2
- data/spec/unit/s3/responses/error_spec.rb +2 -2
- data/spec/unit/s3/responses/success_spec.rb +3 -3
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202c6e531b7304c0c763d2d961f7cd39558365a3
|
4
|
+
data.tar.gz: de555c607a769593a7cb2ab58b522ea949fddc11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba9db5fc1b474cc3727f4bbbf55d7503d5d3fb883071031e9468cc9f2f497f99c7cd3a1bb8759b358f47e3549a082b0cb3342725536838731a8480c39480ac7
|
7
|
+
data.tar.gz: 87dde04297067c65ff0190970e49142b72d5e6ad94eb5d4f2bd352ad7dc9689df6921a3923af03e97172582404187f3e6d37be4c5760197c782269ad47d537a7
|
data/.travis.yml
CHANGED
data/lib/fake_aws/s3/rack_app.rb
CHANGED
@@ -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
|
9
|
-
|
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
|
-
|
14
|
-
|
17
|
+
private
|
18
|
+
|
19
|
+
def common_headers
|
20
|
+
super.merge("Content-Type" => "application/xml")
|
15
21
|
end
|
16
22
|
|
17
|
-
def
|
18
|
-
|
23
|
+
def status_code
|
24
|
+
error.status_code
|
19
25
|
end
|
20
26
|
|
21
|
-
def
|
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(
|
9
|
-
|
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
|
|
data/lib/fake_aws/version.rb
CHANGED
@@ -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
|
7
|
+
expect(subject).to be_ok
|
8
8
|
end
|
9
9
|
|
10
10
|
it "has an empty body" do
|
11
|
-
expect(subject
|
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.
|
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(
|
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
|
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
|
+
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-
|
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:
|