api-auth 1.5.0 → 2.0.0
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/.gitignore +10 -44
- data/.rubocop.yml +102 -0
- data/.travis.yml +1 -0
- data/Appraisals +8 -0
- data/CHANGELOG.md +8 -1
- data/Gemfile +3 -0
- data/README.md +33 -5
- data/VERSION +1 -1
- data/api_auth.gemspec +17 -17
- data/gemfiles/rails_23.gemfile +3 -0
- data/gemfiles/rails_30.gemfile +3 -0
- data/gemfiles/rails_31.gemfile +5 -0
- data/gemfiles/rails_32.gemfile +5 -0
- data/gemfiles/rails_4.gemfile +2 -0
- data/gemfiles/rails_41.gemfile +2 -0
- data/gemfiles/rails_42.gemfile +2 -0
- data/lib/api-auth.rb +1 -1
- data/lib/api_auth/base.rb +21 -25
- data/lib/api_auth/errors.rb +4 -3
- data/lib/api_auth/headers.rb +11 -27
- data/lib/api_auth/helpers.rb +2 -6
- data/lib/api_auth/railtie.rb +5 -50
- data/lib/api_auth/request_drivers/action_controller.rb +7 -13
- data/lib/api_auth/request_drivers/action_dispatch.rb +0 -6
- data/lib/api_auth/request_drivers/curb.rb +8 -14
- data/lib/api_auth/request_drivers/faraday.rb +11 -21
- data/lib/api_auth/request_drivers/httpi.rb +8 -14
- data/lib/api_auth/request_drivers/net_http.rb +8 -14
- data/lib/api_auth/request_drivers/rack.rb +10 -16
- data/lib/api_auth/request_drivers/rest_client.rb +9 -15
- data/spec/api_auth_spec.rb +90 -88
- data/spec/headers_spec.rb +69 -84
- data/spec/helpers_spec.rb +7 -9
- data/spec/railtie_spec.rb +42 -72
- data/spec/request_drivers/action_controller_spec.rb +53 -55
- data/spec/request_drivers/action_dispatch_spec.rb +52 -55
- data/spec/request_drivers/curb_spec.rb +25 -28
- data/spec/request_drivers/faraday_spec.rb +54 -56
- data/spec/request_drivers/httpi_spec.rb +42 -48
- data/spec/request_drivers/net_http_spec.rb +51 -53
- data/spec/request_drivers/rack_spec.rb +58 -60
- data/spec/request_drivers/rest_client_spec.rb +86 -89
- data/spec/spec_helper.rb +9 -9
- metadata +4 -11
- data/Gemfile.lock +0 -115
- data/gemfiles/rails_23.gemfile.lock +0 -70
- data/gemfiles/rails_30.gemfile.lock +0 -92
- data/gemfiles/rails_31.gemfile.lock +0 -98
- data/gemfiles/rails_32.gemfile.lock +0 -97
- data/gemfiles/rails_4.gemfile.lock +0 -94
- data/gemfiles/rails_41.gemfile.lock +0 -98
- data/gemfiles/rails_42.gemfile.lock +0 -115
@@ -3,12 +3,11 @@ require 'spec_helper'
|
|
3
3
|
if defined?(ActionController::Request)
|
4
4
|
|
5
5
|
describe ApiAuth::RequestDrivers::ActionControllerRequest do
|
6
|
-
|
7
|
-
let(:timestamp){ Time.now.utc.httpdate }
|
6
|
+
let(:timestamp) { Time.now.utc.httpdate }
|
8
7
|
|
9
8
|
let(:request) do
|
10
9
|
ActionController::Request.new(
|
11
|
-
'AUTHORIZATION'
|
10
|
+
'AUTHORIZATION' => 'APIAuth 1044:12345',
|
12
11
|
'PATH_INFO' => '/resource.xml',
|
13
12
|
'QUERY_STRING' => 'foo=bar&bar=foo',
|
14
13
|
'REQUEST_METHOD' => 'PUT',
|
@@ -20,65 +19,65 @@ if defined?(ActionController::Request)
|
|
20
19
|
)
|
21
20
|
end
|
22
21
|
|
23
|
-
subject(:driven_request){ ApiAuth::RequestDrivers::ActionControllerRequest.new(request) }
|
22
|
+
subject(:driven_request) { ApiAuth::RequestDrivers::ActionControllerRequest.new(request) }
|
24
23
|
|
25
|
-
describe
|
26
|
-
it
|
24
|
+
describe 'getting headers correctly' do
|
25
|
+
it 'gets the content_type' do
|
27
26
|
expect(driven_request.content_type).to eq('text/plain')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
29
|
+
it 'gets the content_md5' do
|
31
30
|
expect(driven_request.content_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
33
|
+
it 'gets the request_uri' do
|
35
34
|
expect(driven_request.request_uri).to eq('/resource.xml?foo=bar&bar=foo')
|
36
35
|
end
|
37
36
|
|
38
|
-
it
|
37
|
+
it 'gets the timestamp' do
|
39
38
|
expect(driven_request.timestamp).to eq(timestamp)
|
40
39
|
end
|
41
40
|
|
42
|
-
it
|
41
|
+
it 'gets the authorization_header' do
|
43
42
|
expect(driven_request.authorization_header).to eq('APIAuth 1044:12345')
|
44
43
|
end
|
45
44
|
|
46
|
-
describe
|
47
|
-
it
|
45
|
+
describe '#calculated_md5' do
|
46
|
+
it 'calculates md5 from the body' do
|
48
47
|
expect(driven_request.calculated_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
49
48
|
end
|
50
49
|
|
51
|
-
it
|
50
|
+
it 'treats no body as empty string' do
|
52
51
|
request.env['rack.input'] = StringIO.new
|
53
52
|
request.env['CONTENT_LENGTH'] = 0
|
54
53
|
expect(driven_request.calculated_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
|
-
describe
|
59
|
-
context
|
57
|
+
describe 'http_method' do
|
58
|
+
context 'when put request' do
|
60
59
|
let(:request) do
|
61
60
|
ActionController::Request.new('REQUEST_METHOD' => 'PUT')
|
62
61
|
end
|
63
62
|
|
64
|
-
it
|
63
|
+
it 'returns upcased put' do
|
65
64
|
expect(driven_request.http_method).to eq('PUT')
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
69
|
-
context
|
68
|
+
context 'when get request' do
|
70
69
|
let(:request) do
|
71
70
|
ActionController::Request.new('REQUEST_METHOD' => 'GET')
|
72
71
|
end
|
73
72
|
|
74
|
-
it
|
73
|
+
it 'returns upcased get' do
|
75
74
|
expect(driven_request.http_method).to eq('GET')
|
76
75
|
end
|
77
76
|
end
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
81
|
-
describe
|
80
|
+
describe 'setting headers correctly' do
|
82
81
|
let(:request) do
|
83
82
|
ActionController::Request.new(
|
84
83
|
'PATH_INFO' => '/resource.xml',
|
@@ -90,144 +89,143 @@ if defined?(ActionController::Request)
|
|
90
89
|
)
|
91
90
|
end
|
92
91
|
|
93
|
-
describe
|
94
|
-
context
|
92
|
+
describe '#populate_content_md5' do
|
93
|
+
context 'when getting' do
|
95
94
|
it "doesn't populate content-md5" do
|
96
95
|
request.env['REQUEST_METHOD'] = 'GET'
|
97
96
|
driven_request.populate_content_md5
|
98
|
-
expect(request.env[
|
97
|
+
expect(request.env['Content-MD5']).to be_nil
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
102
|
-
context
|
103
|
-
it
|
101
|
+
context 'when posting' do
|
102
|
+
it 'populates content-md5' do
|
104
103
|
request.env['REQUEST_METHOD'] = 'POST'
|
105
104
|
driven_request.populate_content_md5
|
106
|
-
expect(request.env[
|
105
|
+
expect(request.env['Content-MD5']).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
107
106
|
end
|
108
107
|
|
109
|
-
it
|
108
|
+
it 'refreshes the cached headers' do
|
110
109
|
driven_request.populate_content_md5
|
111
110
|
expect(driven_request.content_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
112
111
|
end
|
113
112
|
end
|
114
113
|
|
115
|
-
context
|
116
|
-
it
|
114
|
+
context 'when putting' do
|
115
|
+
it 'populates content-md5' do
|
117
116
|
request.env['REQUEST_METHOD'] = 'PUT'
|
118
117
|
driven_request.populate_content_md5
|
119
|
-
expect(request.env[
|
118
|
+
expect(request.env['Content-MD5']).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
120
119
|
end
|
121
120
|
|
122
|
-
it
|
121
|
+
it 'refreshes the cached headers' do
|
123
122
|
driven_request.populate_content_md5
|
124
123
|
expect(driven_request.content_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
128
|
-
context
|
127
|
+
context 'when deleting' do
|
129
128
|
it "doesn't populate content-md5" do
|
130
129
|
request.env['REQUEST_METHOD'] = 'DELETE'
|
131
130
|
driven_request.populate_content_md5
|
132
|
-
expect(request.env[
|
131
|
+
expect(request.env['Content-MD5']).to be_nil
|
133
132
|
end
|
134
133
|
end
|
135
|
-
|
136
134
|
end
|
137
135
|
|
138
|
-
describe
|
136
|
+
describe '#set_date' do
|
139
137
|
before do
|
140
138
|
allow(Time).to receive_message_chain(:now, :utc, :httpdate).and_return(timestamp)
|
141
139
|
end
|
142
140
|
|
143
|
-
it
|
141
|
+
it 'sets the date header of the request' do
|
144
142
|
driven_request.set_date
|
145
143
|
expect(request.env['HTTP_DATE']).to eq(timestamp)
|
146
144
|
end
|
147
145
|
|
148
|
-
it
|
146
|
+
it 'refreshes the cached headers' do
|
149
147
|
driven_request.set_date
|
150
148
|
expect(driven_request.timestamp).to eq(timestamp)
|
151
149
|
end
|
152
150
|
end
|
153
151
|
|
154
|
-
describe
|
155
|
-
it
|
152
|
+
describe '#set_auth_header' do
|
153
|
+
it 'sets the auth header' do
|
156
154
|
driven_request.set_auth_header('APIAuth 1044:54321')
|
157
155
|
expect(request.env['Authorization']).to eq('APIAuth 1044:54321')
|
158
156
|
end
|
159
157
|
end
|
160
158
|
end
|
161
159
|
|
162
|
-
describe
|
163
|
-
context
|
160
|
+
describe 'md5_mismatch?' do
|
161
|
+
context 'when getting' do
|
164
162
|
before do
|
165
163
|
request.env['REQUEST_METHOD'] = 'GET'
|
166
164
|
end
|
167
165
|
|
168
|
-
it
|
166
|
+
it 'is false' do
|
169
167
|
expect(driven_request.md5_mismatch?).to be false
|
170
168
|
end
|
171
169
|
end
|
172
170
|
|
173
|
-
context
|
171
|
+
context 'when posting' do
|
174
172
|
before do
|
175
173
|
request.env['REQUEST_METHOD'] = 'POST'
|
176
174
|
end
|
177
175
|
|
178
|
-
context
|
176
|
+
context 'when calculated matches sent' do
|
179
177
|
before do
|
180
|
-
request.env[
|
178
|
+
request.env['CONTENT_MD5'] = 'kZXQvrKoieG+Be1rsZVINw=='
|
181
179
|
end
|
182
180
|
|
183
|
-
it
|
181
|
+
it 'is false' do
|
184
182
|
expect(driven_request.md5_mismatch?).to be false
|
185
183
|
end
|
186
184
|
end
|
187
185
|
|
188
186
|
context "when calculated doesn't match sent" do
|
189
187
|
before do
|
190
|
-
request.env[
|
188
|
+
request.env['CONTENT_MD5'] = '3'
|
191
189
|
end
|
192
190
|
|
193
|
-
it
|
191
|
+
it 'is true' do
|
194
192
|
expect(driven_request.md5_mismatch?).to be true
|
195
193
|
end
|
196
194
|
end
|
197
195
|
end
|
198
196
|
|
199
|
-
context
|
197
|
+
context 'when putting' do
|
200
198
|
before do
|
201
199
|
request.env['REQUEST_METHOD'] = 'PUT'
|
202
200
|
end
|
203
201
|
|
204
|
-
context
|
202
|
+
context 'when calculated matches sent' do
|
205
203
|
before do
|
206
|
-
request.env[
|
204
|
+
request.env['CONTENT_MD5'] = 'kZXQvrKoieG+Be1rsZVINw=='
|
207
205
|
end
|
208
206
|
|
209
|
-
it
|
207
|
+
it 'is false' do
|
210
208
|
expect(driven_request.md5_mismatch?).to be false
|
211
209
|
end
|
212
210
|
end
|
213
211
|
|
214
212
|
context "when calculated doesn't match sent" do
|
215
213
|
before do
|
216
|
-
request.env[
|
214
|
+
request.env['CONTENT_MD5'] = '3'
|
217
215
|
end
|
218
216
|
|
219
|
-
it
|
217
|
+
it 'is true' do
|
220
218
|
expect(driven_request.md5_mismatch?).to be true
|
221
219
|
end
|
222
220
|
end
|
223
221
|
end
|
224
222
|
|
225
|
-
context
|
223
|
+
context 'when deleting' do
|
226
224
|
before do
|
227
225
|
request.env['REQUEST_METHOD'] = 'DELETE'
|
228
226
|
end
|
229
227
|
|
230
|
-
it
|
228
|
+
it 'is false' do
|
231
229
|
expect(driven_request.md5_mismatch?).to be false
|
232
230
|
end
|
233
231
|
end
|
@@ -3,8 +3,7 @@ require 'spec_helper'
|
|
3
3
|
if defined?(ActionDispatch::Request)
|
4
4
|
|
5
5
|
describe ApiAuth::RequestDrivers::ActionDispatchRequest do
|
6
|
-
|
7
|
-
let(:timestamp){ Time.now.utc.httpdate }
|
6
|
+
let(:timestamp) { Time.now.utc.httpdate }
|
8
7
|
|
9
8
|
let(:request) do
|
10
9
|
ActionDispatch::Request.new(
|
@@ -20,66 +19,65 @@ if defined?(ActionDispatch::Request)
|
|
20
19
|
)
|
21
20
|
end
|
22
21
|
|
23
|
-
subject(:driven_request){ ApiAuth::RequestDrivers::ActionDispatchRequest.new(request) }
|
22
|
+
subject(:driven_request) { ApiAuth::RequestDrivers::ActionDispatchRequest.new(request) }
|
24
23
|
|
25
|
-
describe
|
26
|
-
it
|
24
|
+
describe 'getting headers correctly' do
|
25
|
+
it 'gets the content_type' do
|
27
26
|
expect(driven_request.content_type).to eq('text/plain')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
29
|
+
it 'gets the content_md5' do
|
31
30
|
expect(driven_request.content_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
33
|
+
it 'gets the request_uri' do
|
35
34
|
expect(driven_request.request_uri).to eq('/resource.xml?foo=bar&bar=foo')
|
36
35
|
end
|
37
36
|
|
38
|
-
it
|
37
|
+
it 'gets the timestamp' do
|
39
38
|
expect(driven_request.timestamp).to eq(timestamp)
|
40
39
|
end
|
41
40
|
|
42
|
-
it
|
41
|
+
it 'gets the authorization_header' do
|
43
42
|
expect(driven_request.authorization_header).to eq('APIAuth 1044:12345')
|
44
43
|
end
|
45
44
|
|
46
|
-
describe
|
47
|
-
it
|
45
|
+
describe '#calculated_md5' do
|
46
|
+
it 'calculates md5 from the body' do
|
48
47
|
expect(driven_request.calculated_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
49
48
|
end
|
50
49
|
|
51
|
-
it
|
50
|
+
it 'treats no body as empty string' do
|
52
51
|
request.env['rack.input'] = StringIO.new
|
53
52
|
request.env['CONTENT_LENGTH'] = 0
|
54
53
|
expect(driven_request.calculated_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
context "when put request" do
|
57
|
+
describe 'http_method' do
|
58
|
+
context 'when put request' do
|
61
59
|
let(:request) do
|
62
60
|
ActionDispatch::Request.new('REQUEST_METHOD' => 'PUT')
|
63
61
|
end
|
64
62
|
|
65
|
-
it
|
63
|
+
it 'returns upcased put' do
|
66
64
|
expect(driven_request.http_method).to eq('PUT')
|
67
65
|
end
|
68
66
|
end
|
69
67
|
|
70
|
-
context
|
68
|
+
context 'when get request' do
|
71
69
|
let(:request) do
|
72
70
|
ActionDispatch::Request.new('REQUEST_METHOD' => 'GET')
|
73
71
|
end
|
74
72
|
|
75
|
-
it
|
73
|
+
it 'returns upcased get' do
|
76
74
|
expect(driven_request.http_method).to eq('GET')
|
77
75
|
end
|
78
76
|
end
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
82
|
-
describe
|
80
|
+
describe 'setting headers correctly' do
|
83
81
|
let(:request) do
|
84
82
|
ActionDispatch::Request.new(
|
85
83
|
'PATH_INFO' => '/resource.xml',
|
@@ -91,144 +89,143 @@ if defined?(ActionDispatch::Request)
|
|
91
89
|
)
|
92
90
|
end
|
93
91
|
|
94
|
-
describe
|
95
|
-
context
|
92
|
+
describe '#populate_content_md5' do
|
93
|
+
context 'when getting' do
|
96
94
|
it "doesn't populate content-md5" do
|
97
95
|
request.env['REQUEST_METHOD'] = 'GET'
|
98
96
|
driven_request.populate_content_md5
|
99
|
-
expect(request.env[
|
97
|
+
expect(request.env['Content-MD5']).to be_nil
|
100
98
|
end
|
101
99
|
end
|
102
100
|
|
103
|
-
context
|
104
|
-
it
|
101
|
+
context 'when posting' do
|
102
|
+
it 'populates content-md5' do
|
105
103
|
request.env['REQUEST_METHOD'] = 'POST'
|
106
104
|
driven_request.populate_content_md5
|
107
|
-
expect(request.env[
|
105
|
+
expect(request.env['Content-MD5']).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
108
106
|
end
|
109
107
|
|
110
|
-
it
|
108
|
+
it 'refreshes the cached headers' do
|
111
109
|
driven_request.populate_content_md5
|
112
110
|
expect(driven_request.content_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
113
111
|
end
|
114
112
|
end
|
115
113
|
|
116
|
-
context
|
117
|
-
it
|
114
|
+
context 'when putting' do
|
115
|
+
it 'populates content-md5' do
|
118
116
|
request.env['REQUEST_METHOD'] = 'PUT'
|
119
117
|
driven_request.populate_content_md5
|
120
|
-
expect(request.env[
|
118
|
+
expect(request.env['Content-MD5']).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
121
119
|
end
|
122
120
|
|
123
|
-
it
|
121
|
+
it 'refreshes the cached headers' do
|
124
122
|
driven_request.populate_content_md5
|
125
123
|
expect(driven_request.content_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
126
124
|
end
|
127
125
|
end
|
128
126
|
|
129
|
-
context
|
127
|
+
context 'when deleting' do
|
130
128
|
it "doesn't populate content-md5" do
|
131
129
|
request.env['REQUEST_METHOD'] = 'DELETE'
|
132
130
|
driven_request.populate_content_md5
|
133
|
-
expect(request.env[
|
131
|
+
expect(request.env['Content-MD5']).to be_nil
|
134
132
|
end
|
135
133
|
end
|
136
|
-
|
137
134
|
end
|
138
135
|
|
139
|
-
describe
|
136
|
+
describe '#set_date' do
|
140
137
|
before do
|
141
138
|
allow(Time).to receive_message_chain(:now, :utc, :httpdate).and_return(timestamp)
|
142
139
|
end
|
143
140
|
|
144
|
-
it
|
141
|
+
it 'sets the date header of the request' do
|
145
142
|
driven_request.set_date
|
146
143
|
expect(request.env['HTTP_DATE']).to eq(timestamp)
|
147
144
|
end
|
148
145
|
|
149
|
-
it
|
146
|
+
it 'refreshes the cached headers' do
|
150
147
|
driven_request.set_date
|
151
148
|
expect(driven_request.timestamp).to eq(timestamp)
|
152
149
|
end
|
153
150
|
end
|
154
151
|
|
155
|
-
describe
|
156
|
-
it
|
152
|
+
describe '#set_auth_header' do
|
153
|
+
it 'sets the auth header' do
|
157
154
|
driven_request.set_auth_header('APIAuth 1044:54321')
|
158
155
|
expect(request.env['Authorization']).to eq('APIAuth 1044:54321')
|
159
156
|
end
|
160
157
|
end
|
161
158
|
end
|
162
159
|
|
163
|
-
describe
|
164
|
-
context
|
160
|
+
describe 'md5_mismatch?' do
|
161
|
+
context 'when getting' do
|
165
162
|
before do
|
166
163
|
request.env['REQUEST_METHOD'] = 'GET'
|
167
164
|
end
|
168
165
|
|
169
|
-
it
|
166
|
+
it 'is false' do
|
170
167
|
expect(driven_request.md5_mismatch?).to be false
|
171
168
|
end
|
172
169
|
end
|
173
170
|
|
174
|
-
context
|
171
|
+
context 'when posting' do
|
175
172
|
before do
|
176
173
|
request.env['REQUEST_METHOD'] = 'POST'
|
177
174
|
end
|
178
175
|
|
179
|
-
context
|
176
|
+
context 'when calculated matches sent' do
|
180
177
|
before do
|
181
|
-
request.env[
|
178
|
+
request.env['CONTENT_MD5'] = 'kZXQvrKoieG+Be1rsZVINw=='
|
182
179
|
end
|
183
180
|
|
184
|
-
it
|
181
|
+
it 'is false' do
|
185
182
|
expect(driven_request.md5_mismatch?).to be false
|
186
183
|
end
|
187
184
|
end
|
188
185
|
|
189
186
|
context "when calculated doesn't match sent" do
|
190
187
|
before do
|
191
|
-
request.env[
|
188
|
+
request.env['CONTENT_MD5'] = '3'
|
192
189
|
end
|
193
190
|
|
194
|
-
it
|
191
|
+
it 'is true' do
|
195
192
|
expect(driven_request.md5_mismatch?).to be true
|
196
193
|
end
|
197
194
|
end
|
198
195
|
end
|
199
196
|
|
200
|
-
context
|
197
|
+
context 'when putting' do
|
201
198
|
before do
|
202
199
|
request.env['REQUEST_METHOD'] = 'PUT'
|
203
200
|
end
|
204
201
|
|
205
|
-
context
|
202
|
+
context 'when calculated matches sent' do
|
206
203
|
before do
|
207
|
-
request.env[
|
204
|
+
request.env['CONTENT_MD5'] = 'kZXQvrKoieG+Be1rsZVINw=='
|
208
205
|
end
|
209
206
|
|
210
|
-
it
|
207
|
+
it 'is false' do
|
211
208
|
expect(driven_request.md5_mismatch?).to be false
|
212
209
|
end
|
213
210
|
end
|
214
211
|
|
215
212
|
context "when calculated doesn't match sent" do
|
216
213
|
before do
|
217
|
-
request.env[
|
214
|
+
request.env['CONTENT_MD5'] = '3'
|
218
215
|
end
|
219
216
|
|
220
|
-
it
|
217
|
+
it 'is true' do
|
221
218
|
expect(driven_request.md5_mismatch?).to be true
|
222
219
|
end
|
223
220
|
end
|
224
221
|
end
|
225
222
|
|
226
|
-
context
|
223
|
+
context 'when deleting' do
|
227
224
|
before do
|
228
225
|
request.env['REQUEST_METHOD'] = 'DELETE'
|
229
226
|
end
|
230
227
|
|
231
|
-
it
|
228
|
+
it 'is false' do
|
232
229
|
expect(driven_request.md5_mismatch?).to be false
|
233
230
|
end
|
234
231
|
end
|