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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e1ef918ca1ef466e983de48748ac507cde298bce
4
- data.tar.gz: 5b51e1abc057e78f5e6a2c651c5b2f20ec1b6049
2
+ SHA256:
3
+ metadata.gz: 98d93b9da867444521efc5c2d82d14b37c2b5743324865f96d2f6c0603ad8256
4
+ data.tar.gz: 3f78a90b58f6de6582088185f995195841995e9b2a0a9518a93ecee081eb8416
5
5
  SHA512:
6
- metadata.gz: 70ee9fa76cb6d0174fb88169adc3a854aea6d86da94ee058cb64500ee881b9fcfd8e863f55557d286e6c4458ebc0e67189cbeb78cdab877e3d7b4c06d2e8251d
7
- data.tar.gz: 116d2337e1daa6852b23172766817b5c17864ec95db124fb50b441a5ab65fd32d755b2605cfcbb4832fd8891d28c98e888389cd9b689b4308d08d2909ddb4b55
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.txt is up-to-date
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)
@@ -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
- if %w[GET DELETE].include?(env['REQUEST_METHOD'])
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 = env[: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 env[:params].is_a?(Hash)
231
- if data = build_multipart(env[:params])
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(env[:params])
238
+ env[:input] = params_to_string(params)
237
239
  end
238
240
  else
239
- env[:input] = env[:params]
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 an IO
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 content.respond_to?(:read) && (content.is_a?(IO) || content.is_a?(StringIO))
32
- initialize_from_io(content, original_filename)
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 initialize_from_io(io, original_filename)
66
- @tempfile = io
67
- @original_filename = original_filename || raise(ArgumentError, 'Missing `original_filename` for IO')
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)
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Test
3
- VERSION = '0.8.2'.freeze
3
+ VERSION = '0.8.3'.freeze
4
4
  end
5
5
  end
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.2
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: 2017-11-21 00:00:00.000000000 Z
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.14
184
+ rubygems_version: 2.7.6
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Simple testing API built on Rack