airborne 0.1.14 → 0.1.15
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/airborne.gemspec +3 -3
- data/lib/airborne/request_expectations.rb +17 -1
- data/spec/airborne/expectations/expect_status_spec.rb +8 -0
- 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: 6ce172c348689ccc6d7d3df32523db62d7671a1e
|
4
|
+
data.tar.gz: ec99365c4dcc0920dcd02197f47e2bb6dd985999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c1a8944f16fb51139cf02d0e3bf29e30217ce9e6bf8d25116fc9cc221e1812426bef30d55cbf475ef476375f8b9393ea86c801cd81a0a588ea046d79cf4e36
|
7
|
+
data.tar.gz: d141eaa4f1917c759e0c1e7ea7665fe07085f4c375737ae2d3286e570d2a59c2647482f3a52004c775617635f859fd0ae88d0e097e4692ca555565dd4e2cfe06
|
data/airborne.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'airborne'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2015-03-
|
3
|
+
s.version = '0.1.15'
|
4
|
+
s.date = '2015-03-03'
|
5
5
|
s.summary = "RSpec driven API testing framework"
|
6
6
|
s.authors = ["Alex Friedman", "Seth Pollack"]
|
7
7
|
s.email = ['a.friedman07@gmail.com', 'teampollack@gmail.com']
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.files = `git ls-files`.split("\n")
|
10
10
|
s.license = 'MIT'
|
11
11
|
s.add_runtime_dependency 'rspec', '~> 3.1', '>= 3.1.0'
|
12
|
-
s.add_runtime_dependency 'rest-client', '~> 1.7', '>= 1.7.3'
|
12
|
+
s.add_runtime_dependency 'rest-client', '~> 1.7', '>= 1.7.3' #version 1.7.3 fixes security vulnerability https://github.com/brooklynDev/airborne/issues/41
|
13
13
|
s.add_runtime_dependency 'rack-test', '~> 0.6', '>= 0.6.2'
|
14
14
|
s.add_runtime_dependency 'activesupport', '>= 3.0.0', '>= 3.0.0'
|
15
15
|
s.add_development_dependency 'webmock', '~> 0'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'date'
|
3
|
+
require 'rack/utils'
|
3
4
|
|
4
5
|
module Airborne
|
5
6
|
class ExpectationError < StandardError; end
|
@@ -32,7 +33,7 @@ module Airborne
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def expect_status(code)
|
35
|
-
expect(response.code).to eq(code)
|
36
|
+
expect(response.code).to eq(resolve_status(code, response.code))
|
36
37
|
end
|
37
38
|
|
38
39
|
def expect_header(key, content)
|
@@ -224,5 +225,20 @@ module Airborne
|
|
224
225
|
[String, Regexp, Float, Fixnum, Bignum, TrueClass, FalseClass, NilClass].include?(expectations.class)
|
225
226
|
end
|
226
227
|
|
228
|
+
# Resolve a supplied status to the appropriate class for the returned
|
229
|
+
# status being tested. This helps reduce brittleness due to '200' != 200
|
230
|
+
# when for the purposes of testing a response it is the same thing.
|
231
|
+
#
|
232
|
+
# @param candidate
|
233
|
+
# @param authority
|
234
|
+
# @return [String]
|
235
|
+
def resolve_status(candidate, authority)
|
236
|
+
candidate = Rack::Utils::SYMBOL_TO_STATUS_CODE[candidate] if candidate.kind_of?(Symbol)
|
237
|
+
case authority
|
238
|
+
when String then candidate.to_s
|
239
|
+
when Fixnum then candidate.to_i
|
240
|
+
else candidate
|
241
|
+
end
|
242
|
+
end
|
227
243
|
end
|
228
244
|
end
|
@@ -12,4 +12,12 @@ describe 'expect_status' do
|
|
12
12
|
get '/simple_get'
|
13
13
|
expect{expect_status(123)}.to raise_error
|
14
14
|
end
|
15
|
+
|
16
|
+
it 'should translate symbol codes to whatever is appropriate for the request' do
|
17
|
+
mock_get('simple_get')
|
18
|
+
get '/simple_get'
|
19
|
+
expect_status(:ok)
|
20
|
+
expect_status(200)
|
21
|
+
expect_status('200')
|
22
|
+
end
|
15
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airborne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Friedman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|