aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/response_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/response_test.rb')
-rw-r--r--actionpack/test/dispatch/response_test.rb35
1 files changed, 17 insertions, 18 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 82cc21b17a..126379a23c 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -146,7 +146,7 @@ class ResponseTest < ActiveSupport::TestCase
test "cookies" do
@response.set_cookie("user_name", :value => "david", :path => "/")
- status, headers, body = @response.to_a
+ _status, headers, _body = @response.to_a
assert_equal "user_name=david; path=/", headers["Set-Cookie"]
assert_equal({"user_name" => "david"}, @response.cookies)
end
@@ -154,7 +154,7 @@ class ResponseTest < ActiveSupport::TestCase
test "multiple cookies" do
@response.set_cookie("user_name", :value => "david", :path => "/")
@response.set_cookie("login", :value => "foo&bar", :path => "/", :expires => Time.utc(2005, 10, 10,5))
- status, headers, body = @response.to_a
+ _status, headers, _body = @response.to_a
assert_equal "user_name=david; path=/\nlogin=foo%26bar; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000", headers["Set-Cookie"]
assert_equal({"login" => "foo&bar", "user_name" => "david"}, @response.cookies)
end
@@ -163,7 +163,6 @@ class ResponseTest < ActiveSupport::TestCase
@response.set_cookie("user_name", :value => "david", :path => "/")
@response.set_cookie("login", :value => "foo&bar", :path => "/", :expires => Time.utc(2005, 10, 10,5))
@response.delete_cookie("login")
- status, headers, body = @response.to_a
assert_equal({"user_name" => "david", "login" => nil}, @response.cookies)
end
@@ -185,13 +184,13 @@ class ResponseTest < ActiveSupport::TestCase
test "read charset and content type" do
resp = ActionDispatch::Response.new.tap { |response|
response.charset = 'utf-16'
- response.content_type = Mime::Type[:XML]
+ response.content_type = Mime[:xml]
response.body = 'Hello'
}
resp.to_a
assert_equal('utf-16', resp.charset)
- assert_equal(Mime::Type[:XML], resp.content_type)
+ assert_equal(Mime[:xml], resp.content_type)
assert_equal('application/xml; charset=utf-16', resp.headers['Content-Type'])
end
@@ -299,10 +298,10 @@ class ResponseHeadersTest < ActiveSupport::TestCase
@response.set_header 'Foo', '1'
end
- test 'have_header?' do
- assert @response.have_header? 'Foo'
- assert_not @response.have_header? 'foo'
- assert_not @response.have_header? nil
+ test 'has_header?' do
+ assert @response.has_header? 'Foo'
+ assert_not @response.has_header? 'foo'
+ assert_not @response.has_header? nil
end
test 'get_header' do
@@ -313,11 +312,11 @@ class ResponseHeadersTest < ActiveSupport::TestCase
test 'set_header' do
assert_equal '2', @response.set_header('Foo', '2')
- assert @response.have_header?('Foo')
+ assert @response.has_header?('Foo')
assert_equal '2', @response.get_header('Foo')
assert_nil @response.set_header('Foo', nil)
- assert @response.have_header?('Foo')
+ assert @response.has_header?('Foo')
assert_nil @response.get_header('Foo')
end
@@ -325,10 +324,10 @@ class ResponseHeadersTest < ActiveSupport::TestCase
assert_nil @response.delete_header(nil)
assert_nil @response.delete_header('foo')
- assert @response.have_header?('Foo')
+ assert @response.has_header?('Foo')
assert_equal '1', @response.delete_header('Foo')
- assert_not @response.have_header?('Foo')
+ assert_not @response.has_header?('Foo')
end
test 'add_header' do
@@ -342,12 +341,12 @@ class ResponseHeadersTest < ActiveSupport::TestCase
# Add nil to a nonexistent header
assert_nil @response.add_header('Bar', nil)
- assert_not @response.have_header?('Bar')
+ assert_not @response.has_header?('Bar')
assert_nil @response.get_header('Bar')
# Add a value to a nonexistent header
assert_equal '1', @response.add_header('Bar', '1')
- assert @response.have_header?('Bar')
+ assert @response.has_header?('Bar')
assert_equal '1', @response.get_header('Bar')
end
end
@@ -393,7 +392,7 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest
@app = lambda { |env|
ActionDispatch::Response.new.tap { |resp|
resp.charset = 'utf-16'
- resp.content_type = Mime::Type[:XML]
+ resp.content_type = Mime[:xml]
resp.body = 'Hello'
}.to_a
}
@@ -402,7 +401,7 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest
assert_response :success
assert_equal('utf-16', @response.charset)
- assert_equal(Mime::Type[:XML], @response.content_type)
+ assert_equal(Mime[:xml], @response.content_type)
assert_equal('application/xml; charset=utf-16', @response.headers['Content-Type'])
end
@@ -418,7 +417,7 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest
assert_response :success
assert_equal('utf-16', @response.charset)
- assert_equal(Mime::Type[:XML], @response.content_type)
+ assert_equal(Mime[:xml], @response.content_type)
assert_equal('application/xml; charset=utf-16', @response.headers['Content-Type'])
end