rspec-request_describer 0.3.0 → 0.3.1

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: a8e2fcd9ca31fc770513b5d6c8aac8167a1a728f1413e830e4169bf680c66b0e
4
- data.tar.gz: 6f7b366b4587b7c7b2fb327910a295f4a3652c6008e51223f70e358086bf03b9
3
+ metadata.gz: 56cff985b6ca3e943ccf4eeb4e22442645cc39ff587e0ea91fe384274d6b9a30
4
+ data.tar.gz: 2597ebc166da6f35b692e7faddd46b83a8a064ac6d9a2d452507d47f96edad81
5
5
  SHA512:
6
- metadata.gz: '08ea603385b4e6820f15ae69d59e9653150564e89aca496366dcb1bf96feda8ccc97f77d1399af4725f0978a74f1c187a1bf66eede4836b99adeb95972ec3511'
7
- data.tar.gz: d9203c8edf2eca941726f4909156705b226ea14a1ff690606dd439241f174bd04231cdc35872d9eef014d72d5d7199ee3beeaa68edb07d5f699168a3f79268ad
6
+ metadata.gz: 79ee62dd7454fbd56c51c2b7ebbc39677c57228c1edc6943e3ceccc46f30f539d1a7165458a01a84270dee8ec07039ecc682a12ae5e9a5d827720714580cc72c
7
+ data.tar.gz: dc22b1bf82374f5fddbc78655b7838ae064cf9155f2794929753e2c8e6cb039f81b02f06bda9e33abc653aae6428a8f0479bde3639736633cfb87deff616e8da
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## v0.3.1 - 2019-05-08
9
+
10
+ - Fix env calculation timing.
11
+
8
12
  ## v0.3.0 - 2019-05-05
9
13
 
10
14
  ### Added
@@ -33,7 +33,7 @@ module RSpec
33
33
  end
34
34
 
35
35
  let(:request_body) do
36
- if env['CONTENT_TYPE'] == 'application/json'
36
+ if headers.any? { |key, value| key.to_s.casecmp('content-type').zero? && value == 'application/json' }
37
37
  params.to_json
38
38
  else
39
39
  params.inject({}) do |result, (key, value)|
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module RequestDescriber
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
@@ -1,3 +1,5 @@
1
+ require 'openssl'
2
+
1
3
  RSpec.describe RSpec::RequestDescriber do
2
4
  include RSpec::RequestDescriber
3
5
 
@@ -68,6 +70,23 @@ RSpec.describe RSpec::RequestDescriber do
68
70
  end
69
71
  end
70
72
 
73
+ context 'with headers including request body' do
74
+ before do
75
+ headers['X-Signature'] = "sha1=#{OpenSSL::HMAC.hexdigest('SHA1', 'secret', request_body.to_s)}"
76
+ end
77
+
78
+ it 'calls #get with HTTP_ prefixed and stringified keys headers' do
79
+ is_expected.to eq(
80
+ [
81
+ :get,
82
+ '/users',
83
+ headers: { 'HTTP_X_SIGNATURE' => 'sha1=5d61605c3feea9799210ddcb71307d4ba264225f' },
84
+ params: {}
85
+ ]
86
+ )
87
+ end
88
+ end
89
+
71
90
  context 'with params' do
72
91
  let(:params) do
73
92
  super().merge('sort' => 'id')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-request_describer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-05 00:00:00.000000000 Z
11
+ date: 2019-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack