airborne 0.3.5 → 0.3.6

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
  SHA256:
3
- metadata.gz: 76027591f241db7b9efd84d1b7218ed94b75aaa6fdc048ae9b19b65ce4d75eee
4
- data.tar.gz: 680096ee8bfcfbfe892e0500a7f53723666ea69f953d70dc5556b58f27e80bbb
3
+ metadata.gz: ff10527022f91760eebf46755e829ee2d0253229bccc1c1266c0913d9357fec5
4
+ data.tar.gz: ca9ef3d342550dcd6f160ec5c21982ea9002a6985b2851cb9859fd3e276e408c
5
5
  SHA512:
6
- metadata.gz: 2f33893ad03e5187642bdd2afbb33d00541018a6d659dce1445d77d041f9da21699b1306a4541e886d29b6013415bbf6de42415a8b43281a1abf66342a634a74
7
- data.tar.gz: f2a98178ac9c3b96e9008155450bc63b3ee4e97d77fd0e0b494b3b080fa6a2b67569a6f8ef8a31e927dc88e8dcffa9a1c4561956480a8f7bb125d536e9f601a4
6
+ metadata.gz: fc0d7fe0a30a8d803733f0e3ecd519a4bd09d4b0469f4bc2b2f806e1390021efad3338e516c2c75ad3dc8788dc65a1e497a1db57759f6f7d50e98a27cd556552
7
+ data.tar.gz: 1ac158dafa41fa4b2435d018919c7b45938b9fc21c8082da95e7a76186d2822e366139210d1e7b7d0f4fddb22e5c2e290a1bfb1d5b0335ef9297ae22568574f3
@@ -2,7 +2,7 @@ require 'date'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'airborne'
5
- s.version = '0.3.5'
5
+ s.version = '0.3.6'
6
6
  s.date = Date.today.to_s
7
7
  s.summary = 'RSpec driven API testing framework'
8
8
  s.authors = ['Alex Friedman', 'Seth Pollack']
@@ -7,8 +7,8 @@ module Airborne
7
7
  verify_ssl = options.fetch(:verify_ssl, true)
8
8
  res = if method == :post || method == :patch || method == :put || method == :delete
9
9
  begin
10
- request_body = options[:body].nil? || options[:body].empty? ? '' : options[:body]
11
- request_body = request_body.to_json if is_json_request(headers) && !request_body.empty?
10
+ request_body = options[:body].nil? || is_empty(options[:body]) ? '' : options[:body]
11
+ request_body = request_body.to_json if is_json_request(headers) && !is_empty(request_body)
12
12
  RestClient::Request.execute(
13
13
  method: method,
14
14
  url: get_url(url),
@@ -41,6 +41,12 @@ module Airborne
41
41
  header == :json || /application\/([a-zA-Z0-9\.\_\-]*\+?)json/ =~ header
42
42
  end
43
43
 
44
+ def is_empty(body)
45
+ return body.empty? if body.respond_to?(:empty?)
46
+
47
+ false
48
+ end
49
+
44
50
  def base_headers
45
51
  { content_type: :json }.merge(Airborne.configuration.headers || {})
46
52
  end
@@ -14,4 +14,11 @@ describe 'post' do
14
14
  post '/simple_post', 'hello', content_type: 'text/plain'
15
15
  expect(WebMock).to have_requested(:post, url).with(body: 'hello', headers: { 'Content-Type' => 'text/plain' })
16
16
  end
17
+
18
+ it 'should allow testing on post requests with IO body' do
19
+ url = 'http://www.example.com/simple_post'
20
+ stub_request(:post, url)
21
+ post '/simple_post', StringIO.new('hello'), content_type: 'application/octet-stream'
22
+ expect(WebMock).to have_requested(:post, url).with(body: 'hello', headers: { 'Content-Type' => 'application/octet-stream' })
23
+ end
17
24
  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.3.5
4
+ version: 0.3.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: 2020-07-27 00:00:00.000000000 Z
12
+ date: 2020-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec