rack-test 0.8.2 → 0.8.3
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 +5 -5
- data/History.md +11 -0
- data/README.md +3 -2
- data/lib/rack/test.rb +9 -9
- data/lib/rack/test/uploaded_file.rb +7 -7
- data/lib/rack/test/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 98d93b9da867444521efc5c2d82d14b37c2b5743324865f96d2f6c0603ad8256
|
4
|
+
data.tar.gz: 3f78a90b58f6de6582088185f995195841995e9b2a0a9518a93ecee081eb8416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd23e7ffcfa4ab19ad2966f36bcab31f49f3ea7f819fb81f15ce874437d8c6b96c6844f40499512042166b007d940b819b44e8d978ba4001f77fe515225f529
|
7
|
+
data.tar.gz: 9d0479de503ae1a74f2aa9263b39dfdabf1745c17bed3fc18e6aaf757bf0b7428510f26a08c0021090ec98f8125eca74fb19e9f7f19eef41a94dd9847a441472
|
data/History.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.8.3 / 2018-02-27
|
2
|
+
|
3
|
+
* Bug fixes:
|
4
|
+
* Do not set Content-Type if params are explicitly set to nil
|
5
|
+
(Bartek Bułat #212). Fixes #200.
|
6
|
+
* Fix `UploadedFile#new` regression
|
7
|
+
(Per Lundberg #215)
|
8
|
+
|
9
|
+
* Minor enhancements
|
10
|
+
* [CI] Test against Ruby 2.5 (Nicolas Leger #217)
|
11
|
+
|
1
12
|
## 0.8.2 / 2017-11-21
|
2
13
|
|
3
14
|
* Bug fixes:
|
data/README.md
CHANGED
@@ -65,7 +65,7 @@ class HomepageTest < Test::Unit::TestCase
|
|
65
65
|
assert last_response.ok?
|
66
66
|
assert_equal last_response.body, 'All responses are OK'
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def post_with_json
|
70
70
|
# No assertion in this, we just demonstrate how you can post a JSON-encoded string.
|
71
71
|
# By default, Rack::Test will use HTTP form encoding if you pass in a Hash as the
|
@@ -134,6 +134,7 @@ Contributions are welcome. Please make sure to:
|
|
134
134
|
|
135
135
|
## Releasing
|
136
136
|
|
137
|
-
* Ensure History.
|
137
|
+
* Ensure `History.md` is up-to-date
|
138
138
|
* Bump VERSION in lib/rack/test/version.rb
|
139
139
|
* bundle exec thor :release
|
140
|
+
* Updated the [GitHub releases page](https://github.com/rack-test/rack-test/releases)
|
data/lib/rack/test.rb
CHANGED
@@ -217,31 +217,31 @@ module Rack
|
|
217
217
|
# Stringifying and upcasing methods has be commit upstream
|
218
218
|
env['REQUEST_METHOD'] ||= env[:method] ? env[:method].to_s.upcase : 'GET'
|
219
219
|
|
220
|
-
|
220
|
+
params = env.delete(:params) do {} end
|
221
|
+
|
222
|
+
if env['REQUEST_METHOD'] == 'GET'
|
221
223
|
# merge :params with the query string
|
222
|
-
if params
|
224
|
+
if params
|
223
225
|
params = parse_nested_query(params) if params.is_a?(String)
|
224
226
|
|
225
227
|
uri.query = [uri.query, build_nested_query(params)].compact.reject { |v| v == '' }.join('&')
|
226
228
|
end
|
227
229
|
elsif !env.key?(:input)
|
228
|
-
env['CONTENT_TYPE'] ||= 'application/x-www-form-urlencoded'
|
230
|
+
env['CONTENT_TYPE'] ||= 'application/x-www-form-urlencoded' unless params.nil?
|
229
231
|
|
230
|
-
if
|
231
|
-
if data = build_multipart(
|
232
|
+
if params.is_a?(Hash)
|
233
|
+
if data = build_multipart(params)
|
232
234
|
env[:input] = data
|
233
235
|
env['CONTENT_LENGTH'] ||= data.length.to_s
|
234
236
|
env['CONTENT_TYPE'] = "multipart/form-data; boundary=#{MULTIPART_BOUNDARY}"
|
235
237
|
else
|
236
|
-
env[:input] = params_to_string(
|
238
|
+
env[:input] = params_to_string(params)
|
237
239
|
end
|
238
240
|
else
|
239
|
-
env[:input] =
|
241
|
+
env[:input] = params
|
240
242
|
end
|
241
243
|
end
|
242
244
|
|
243
|
-
env.delete(:params)
|
244
|
-
|
245
245
|
set_cookie(env.delete(:cookie), uri) if env.key?(:cookie)
|
246
246
|
|
247
247
|
Rack::MockRequest.env_for(uri.to_s, env)
|
@@ -25,11 +25,11 @@ module Rack
|
|
25
25
|
# file.
|
26
26
|
# @param content_type [String]
|
27
27
|
# @param binary [Boolean] an optional flag that indicates whether the file should be open in binary mode or not.
|
28
|
-
# @param original_filename [String] an optional parameter that provides the original filename if `content` is
|
29
|
-
# object.
|
28
|
+
# @param original_filename [String] an optional parameter that provides the original filename if `content` is a StringIO
|
29
|
+
# object. Not used for other kind of `content` objects.
|
30
30
|
def initialize(content, content_type = 'text/plain', binary = false, original_filename: nil)
|
31
|
-
if
|
32
|
-
|
31
|
+
if original_filename
|
32
|
+
initialize_from_stringio(content, original_filename)
|
33
33
|
else
|
34
34
|
initialize_from_file_path(content)
|
35
35
|
end
|
@@ -62,9 +62,9 @@ module Rack
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
-
def
|
66
|
-
@tempfile =
|
67
|
-
@original_filename = original_filename || raise(ArgumentError, 'Missing `original_filename` for
|
65
|
+
def initialize_from_stringio(stringio, original_filename)
|
66
|
+
@tempfile = stringio
|
67
|
+
@original_filename = original_filename || raise(ArgumentError, 'Missing `original_filename` for StringIO object')
|
68
68
|
end
|
69
69
|
|
70
70
|
def initialize_from_file_path(path)
|
data/lib/rack/test/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -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.6
|
184
|
+
rubygems_version: 2.7.6
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Simple testing API built on Rack
|