diff options
author | yhirano55 <yhirano@me.com> | 2018-04-17 02:41:39 +0900 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2018-04-16 10:41:39 -0700 |
commit | 65eb6edd549dc70af498b6cf4248cc202c565914 (patch) | |
tree | 6be7c77346f266044debe934be040b339b5da259 /test/spec_deflater.rb | |
parent | 985afcddd3638cd9417177404f7764857883a746 (diff) | |
download | rack-65eb6edd549dc70af498b6cf4248cc202c565914.tar.gz |
Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b } (#1253)
Use Ruby >= 1.9 syntax for hashes
* Required Ruby version is >= 2.2, so It's better to use prefer `{ a: :b }` over `{ :a => :b }` in hash syntax.
* It's hard to modify manufally all points, so I've installed rubocop and enabled only `Style/HashSyntax` (All cops are disabled by default)
* Executed `rubocop --auto-correct`
Diffstat (limited to 'test/spec_deflater.rb')
-rw-r--r-- | test/spec_deflater.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/spec_deflater.rb b/test/spec_deflater.rb index b4a526b3..96ccccb0 100644 --- a/test/spec_deflater.rb +++ b/test/spec_deflater.rb @@ -310,7 +310,7 @@ describe Rack::Deflater do 'Content-Type' => 'text/plain' }, 'deflater_options' => { - :include => %w(text/plain) + include: %w(text/plain) } } verify(200, 'Hello World!', 'gzip', options) @@ -322,7 +322,7 @@ describe Rack::Deflater do 'Content-Type' => 'text/plain; charset=us-ascii' }, 'deflater_options' => { - :include => %w(text/plain) + include: %w(text/plain) } } verify(200, 'Hello World!', 'gzip', options) @@ -331,7 +331,7 @@ describe Rack::Deflater do it "not deflate if content-type is not set but given in :include" do options = { 'deflater_options' => { - :include => %w(text/plain) + include: %w(text/plain) } } verify(304, 'Hello World!', { 'gzip' => nil }, options) @@ -343,7 +343,7 @@ describe Rack::Deflater do 'Content-Type' => 'text/plain' }, 'deflater_options' => { - :include => %w(text/json) + include: %w(text/json) } } verify(200, 'Hello World!', { 'gzip' => nil }, options) @@ -352,7 +352,7 @@ describe Rack::Deflater do it "deflate response if :if lambda evaluates to true" do options = { 'deflater_options' => { - :if => lambda { |env, status, headers, body| true } + if: lambda { |env, status, headers, body| true } } } verify(200, 'Hello World!', deflate_or_gzip, options) @@ -361,7 +361,7 @@ describe Rack::Deflater do it "not deflate if :if lambda evaluates to false" do options = { 'deflater_options' => { - :if => lambda { |env, status, headers, body| false } + if: lambda { |env, status, headers, body| false } } } verify(200, 'Hello World!', { 'gzip' => nil }, options) @@ -375,7 +375,7 @@ describe Rack::Deflater do 'Content-Length' => response_len.to_s }, 'deflater_options' => { - :if => lambda { |env, status, headers, body| + if: lambda { |env, status, headers, body| headers['Content-Length'].to_i >= response_len } } @@ -393,7 +393,7 @@ describe Rack::Deflater do end options = { - 'deflater_options' => { :sync => false }, + 'deflater_options' => { sync: false }, 'app_body' => app_body, 'skip_body_verify' => true, } |