airborne 0.1.5 → 0.1.6
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/README.md +7 -2
- data/airborne.gemspec +2 -2
- data/lib/airborne/rest_client_requester.rb +4 -2
- data/spec/airborne/post_spec.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e40cbd3b0c6d8c69639ca38745607ef1f3dae374
|
4
|
+
data.tar.gz: 39f27b4be920837eafc3453c4467d3c2a40b1f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 299c37a89a6dc4144995e69ad81913bf20f8fa4af437f1416093fc37d0a27c473f6ad96ebd82841aade80d27c92b166db00c9c88f538d2d01b2ae0e3cc1f9eb8
|
7
|
+
data.tar.gz: d93e66a29e549f723b13da8ba58623ac64b4bbe422faf706461264e914c67aa4a1410c7e8032c1dbd84bdd4daf919a8b3b9b37079dadd0450d70ad88bbb2a072
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ end
|
|
108
108
|
|
109
109
|
##Making requests
|
110
110
|
|
111
|
-
Airborne uses `rest_client` to make the HTTP request, and supports all HTTP verbs. When creating a test, you can call any of the following methods: `get`, `post`, `put`, `patch`, `delete`, `head`. This will then give you access the following properties:
|
111
|
+
Airborne uses `rest_client` to make the HTTP request, and supports all HTTP verbs. When creating a test, you can call any of the following methods: `get`, `post`, `put`, `patch`, `delete`, `head`, `options`. This will then give you access the following properties:
|
112
112
|
|
113
113
|
* `response` - The HTTP response returned from the request
|
114
114
|
* `headers` - A symbolized hash of the response headers returned by the request
|
@@ -350,11 +350,16 @@ describe 'spec' do
|
|
350
350
|
end
|
351
351
|
```
|
352
352
|
|
353
|
-
|
353
|
+
## Run it from the CLI
|
354
354
|
|
355
355
|
$ cd your/project
|
356
356
|
$ rspec spec
|
357
|
+
## Authors
|
358
|
+
* [Seth Pollack](https://github.com/sethpollack)
|
359
|
+
* [Alex Friedman](https://github.com/brooklynDev)
|
357
360
|
|
361
|
+
## Contributors
|
362
|
+
https://github.com/brooklynDev/airborne/graphs/contributors
|
358
363
|
## License
|
359
364
|
|
360
365
|
The MIT License
|
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 = '2014-
|
3
|
+
s.version = '0.1.6'
|
4
|
+
s.date = '2014-12-10'
|
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']
|
@@ -3,12 +3,14 @@ require 'rest_client'
|
|
3
3
|
module Airborne
|
4
4
|
module RestClientRequester
|
5
5
|
def make_request(method, url, options = {})
|
6
|
-
headers = (options[:headers] || {})
|
6
|
+
headers = {content_type: :json}.merge(options[:headers] || {})
|
7
7
|
base_headers = Airborne.configuration.headers || {}
|
8
8
|
headers = base_headers.merge(headers)
|
9
9
|
res = if method == :post || method == :patch || method == :put
|
10
10
|
begin
|
11
|
-
|
11
|
+
request_body = options[:body].nil? ? "" : options[:body]
|
12
|
+
request_body = request_body.to_json if options[:body].is_a?(Hash)
|
13
|
+
RestClient.send(method, get_url(url), request_body, headers)
|
12
14
|
rescue RestClient::Exception => e
|
13
15
|
e.response
|
14
16
|
end
|
data/spec/airborne/post_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'webmock/rspec'
|
2
3
|
|
3
4
|
describe 'post' do
|
4
5
|
it 'should allow testing on post requests' do
|
@@ -6,4 +7,11 @@ describe 'post' do
|
|
6
7
|
post '/simple_post', {}
|
7
8
|
expect_json_types({status: :string, someNumber: :int})
|
8
9
|
end
|
10
|
+
|
11
|
+
it 'should allow testing on post requests' do
|
12
|
+
url = 'http://www.example.com/simple_post'
|
13
|
+
stub_request(:post, url)
|
14
|
+
post '/simple_post', 'hello', {content_type: "text/plain"}
|
15
|
+
expect(WebMock).to have_requested(:post, url).with(:body => "hello", :headers => {'Content-Type' => 'text/plain'})
|
16
|
+
end
|
9
17
|
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.6
|
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: 2014-
|
12
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.2.
|
184
|
+
rubygems_version: 2.2.0
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: RSpec driven API testing framework
|