spaceborne 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/spaceborne.rb +3 -3
- data/lib/spaceborne/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5efd85c470ba6cc01806761449631cf025c8c292
|
4
|
+
data.tar.gz: bd6a6120ed5496efc901d2d0e9adb23682bc49b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a99e989c2bb0620be367e6c02e4d70301c97f6480343a78ae5703f20d4e8bf2da47f5176db333ac3c9b2bf07153d569a7eba406b0175b5c793276d069b28fe69
|
7
|
+
data.tar.gz: 67b291bcb88be8c825f3e4d452e23ed572a86c8b617ad94ab90c4a153d103e3084fb363c43f017c9d0e5d263f612ecd2c2f1be130f641ce82019d706d656f4f2
|
data/README.md
CHANGED
@@ -89,7 +89,7 @@ describe 'simple get sample' do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
```
|
92
|
-
The parts of the example outside of the wrap_request block are typical rspec. The wrap_request is a spaceborne concept, saying that if anything fails inside of
|
92
|
+
The parts of the example outside of the `wrap_request` block are typical rspec. The `wrap_request` is a spaceborne concept, saying that if anything fails inside of that block, then the failure contains the request, response, as well as why it failed. This is to work around the issue of an expectation failing, and having good info about why, but having no idea what the request or response were that caused the failure. The actual request is done on the `get` line. Validation of the response is the following `expect_*` lines.
|
93
93
|
|
94
94
|
#### Parts of response to validate
|
95
95
|
|
@@ -198,9 +198,9 @@ Validation for headers follows the same pattern as above, although nesting of mu
|
|
198
198
|
## Extensions to Airborne
|
199
199
|
|
200
200
|
1. Uses curlyrest to allow extension of rest-client with curl requests
|
201
|
-
2. Uses wrap_request to bundle groups of expectations so that if any fail,
|
202
|
-
3. json_body is only parsed once after a request rather than on each expect call
|
203
|
-
4. Expectations for headers use the same form as the expectations for json bodies
|
201
|
+
2. Uses wrap_request to bundle groups of expectations so that if any fail, the failure will contain the request and response, rather than just seeing the expectation that failed
|
202
|
+
3. json_body is only parsed once after a request rather than on each expect call (spaceborne resets the body on a new http request).
|
203
|
+
4. Expectations for headers use the same form as the expectations for json bodies.
|
204
204
|
* `expect_header same arguments/handling as expect_json`
|
205
205
|
* `expect_header_types same arguments/handling as expect_json_types`
|
206
206
|
5. It is possible to use non-json data in a request
|
@@ -221,7 +221,7 @@ The following example shows how this works
|
|
221
221
|
}
|
222
222
|
}
|
223
223
|
```
|
224
|
-
You can now validate the fact that each element in the collection has a key which is variant, but a value that has a defined format (first and last are strings).
|
224
|
+
You can now validate the fact that each element in the collection has a key which is variant, but a value that has a defined format (the first and last field values are strings).
|
225
225
|
|
226
226
|
expect_json_types('array_of_hashes.*.*', first: :string, last: :string)
|
227
227
|
expect_json_types('hash_of_hashes.*', first: :string, last: :string)
|
data/lib/spaceborne.rb
CHANGED
@@ -7,8 +7,8 @@ require 'json'
|
|
7
7
|
# module for apitesting with spaceborne
|
8
8
|
module Spaceborne
|
9
9
|
def json?(headers)
|
10
|
-
headers.key?(
|
11
|
-
headers[
|
10
|
+
headers.key?('Content-Type') &&
|
11
|
+
headers['Content-Type'].include?('application/json')
|
12
12
|
end
|
13
13
|
|
14
14
|
def add_time
|
@@ -127,7 +127,7 @@ module Airborne
|
|
127
127
|
private
|
128
128
|
|
129
129
|
def base_headers
|
130
|
-
{
|
130
|
+
{ "Content-Type" => 'application/json' }
|
131
131
|
.merge(Airborne.configuration.headers || {})
|
132
132
|
end
|
133
133
|
end
|
data/lib/spaceborne/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaceborne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|