aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb12
-rw-r--r--actionpack/test/dispatch/debug_exceptions_test.rb2
-rw-r--r--actionpack/test/dispatch/header_test.rb4
-rw-r--r--actionpack/test/dispatch/mime_type_test.rb2
-rw-r--r--actionpack/test/dispatch/reloader_test.rb2
-rw-r--r--actionpack/test/dispatch/request/query_string_parsing_test.rb4
-rw-r--r--actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb2
-rw-r--r--actionpack/test/dispatch/request_test.rb28
-rw-r--r--actionpack/test/dispatch/response_test.rb6
-rw-r--r--actionpack/test/dispatch/routing_test.rb12
-rw-r--r--actionpack/test/dispatch/static_test.rb32
-rw-r--r--actionpack/test/dispatch/uploaded_file_test.rb8
12 files changed, 57 insertions, 57 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 6dcd62572a..af3036d448 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -43,7 +43,7 @@ class CookieJarTest < ActiveSupport::TestCase
def test_each
request.cookie_jar["foo"] = :bar
list = []
- request.cookie_jar.each do |k,v|
+ request.cookie_jar.each do |k, v|
list << [k, v]
end
@@ -52,7 +52,7 @@ class CookieJarTest < ActiveSupport::TestCase
def test_enumerable
request.cookie_jar["foo"] = :bar
- actual = request.cookie_jar.map { |k,v| [k.to_s, v.to_s] }
+ actual = request.cookie_jar.map { |k, v| [k.to_s, v.to_s] }
assert_equal [["foo", "bar"]], actual
end
@@ -95,17 +95,17 @@ class CookiesTest < ActionController::TestCase
end
def authenticate_for_fourteen_days
- cookies["user_name"] = { "value" => "david", "expires" => Time.utc(2005, 10, 10,5) }
+ cookies["user_name"] = { "value" => "david", "expires" => Time.utc(2005, 10, 10, 5) }
head :ok
end
def authenticate_for_fourteen_days_with_symbols
- cookies[:user_name] = { value: "david", expires: Time.utc(2005, 10, 10,5) }
+ cookies[:user_name] = { value: "david", expires: Time.utc(2005, 10, 10, 5) }
head :ok
end
def set_multiple_cookies
- cookies["user_name"] = { "value" => "david", "expires" => Time.utc(2005, 10, 10,5) }
+ cookies["user_name"] = { "value" => "david", "expires" => Time.utc(2005, 10, 10, 5) }
cookies["login"] = "XJ-122"
head :ok
end
@@ -205,7 +205,7 @@ class CookiesTest < ActionController::TestCase
def delete_and_set_cookie
cookies.delete :user_name
- cookies[:user_name] = { value: "david", expires: Time.utc(2005, 10, 10,5) }
+ cookies[:user_name] = { value: "david", expires: Time.utc(2005, 10, 10, 5) }
head :ok
end
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb
index bff52f2a2b..ea477e8908 100644
--- a/actionpack/test/dispatch/debug_exceptions_test.rb
+++ b/actionpack/test/dispatch/debug_exceptions_test.rb
@@ -287,7 +287,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
test "does not show filtered parameters" do
@app = DevelopmentApp
- get "/", params: { "foo"=>"bar" }, headers: { "action_dispatch.show_exceptions" => true,
+ get "/", params: { "foo" => "bar" }, headers: { "action_dispatch.show_exceptions" => true,
"action_dispatch.parameter_filter" => [:foo] }
assert_response 500
assert_match("&quot;foo&quot;=&gt;&quot;[FILTERED]&quot;", body)
diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb
index 6febd5cb68..958450072e 100644
--- a/actionpack/test/dispatch/header_test.rb
+++ b/actionpack/test/dispatch/header_test.rb
@@ -155,8 +155,8 @@ class HeaderTest < ActiveSupport::TestCase
headers = make_headers(env)
headers["Referer"] = "http://example.com/"
headers.merge! "CONTENT_TYPE" => "text/plain"
- assert_equal({ "HTTP_REFERER"=>"http://example.com/",
- "CONTENT_TYPE"=>"text/plain" }, env)
+ assert_equal({ "HTTP_REFERER" => "http://example.com/",
+ "CONTENT_TYPE" => "text/plain" }, env)
end
test "fetch exception" do
diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb
index e558efb88d..2ca03c535a 100644
--- a/actionpack/test/dispatch/mime_type_test.rb
+++ b/actionpack/test/dispatch/mime_type_test.rb
@@ -89,7 +89,7 @@ class MimeTypeTest < ActiveSupport::TestCase
# (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
test "parse other broken acceptlines" do
accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, , pronto/1.00.00, sslvpn/1.00.00.00, */*"
- expect = ["image/gif", "image/x-xbitmap", "image/jpeg","image/pjpeg", "application/x-shockwave-flash", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/msword", "pronto/1.00.00", "sslvpn/1.00.00.00", "*/*"]
+ expect = ["image/gif", "image/x-xbitmap", "image/jpeg", "image/pjpeg", "application/x-shockwave-flash", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/msword", "pronto/1.00.00", "sslvpn/1.00.00.00", "*/*"]
assert_equal expect.map(&:to_s), Mime::Type.parse(accept).map(&:to_s)
end
diff --git a/actionpack/test/dispatch/reloader_test.rb b/actionpack/test/dispatch/reloader_test.rb
index e74b8e40fd..db68549b84 100644
--- a/actionpack/test/dispatch/reloader_test.rb
+++ b/actionpack/test/dispatch/reloader_test.rb
@@ -178,7 +178,7 @@ class ReloaderTest < ActiveSupport::TestCase
def test_cleanup_callbacks_are_called_on_exceptions
cleaned = false
assert_deprecated do
- Reloader.to_cleanup { cleaned = true }
+ Reloader.to_cleanup { cleaned = true }
end
begin
diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb
index 5c992be216..2499c33cef 100644
--- a/actionpack/test/dispatch/request/query_string_parsing_test.rb
+++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb
@@ -97,7 +97,7 @@ class QueryStringParsingTest < ActionDispatch::IntegrationTest
assert_parses({ "action" => { "foo" => { "bar" => nil } } }, "action[foo][bar]")
assert_parses({ "action" => { "foo" => { "bar" => [] } } }, "action[foo][bar][]")
assert_parses({ "action" => { "foo" => [] } }, "action[foo][]")
- assert_parses({ "action"=>{ "foo"=>[{ "bar"=>nil }] } }, "action[foo][][bar]")
+ assert_parses({ "action" => { "foo" => [{ "bar" => nil }] } }, "action[foo][][bar]")
end
def test_array_parses_without_nil
@@ -114,7 +114,7 @@ class QueryStringParsingTest < ActionDispatch::IntegrationTest
assert_parses({ "action" => { "foo" => { "bar" => [nil] } } }, "action[foo][bar][]")
assert_parses({ "action" => { "foo" => [nil] } }, "action[foo][]")
assert_parses({ "action" => { "foo" => [{ "bar" => nil }] } }, "action[foo][][bar]")
- assert_parses({ "action" => ["1",nil] }, "action[]=1&action[]")
+ assert_parses({ "action" => ["1", nil] }, "action[]=1&action[]")
ensure
ActionDispatch::Request::Utils.perform_deep_munge = old_perform_deep_munge
end
diff --git a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
index 5c7558e48d..1169bf0cdb 100644
--- a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
@@ -55,7 +55,7 @@ class UrlEncodedParamsParsingTest < ActionDispatch::IntegrationTest
"products[second]=Pc",
"=Save"
].join("&")
- expected = {
+ expected = {
"customers" => {
"boston" => {
"first" => {
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 13a87b8976..2f41851598 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -581,7 +581,7 @@ class RequestCookie < BaseRequestTest
# some Nokia phone browsers omit the space after the semicolon separator.
# some developers have grown accustomed to using comma in cookie values.
- request = stub_request("HTTP_COOKIE"=>"_session_id=c84ace847,96670c052c6ceb2451fb0f2;is_admin=yes")
+ request = stub_request("HTTP_COOKIE" => "_session_id=c84ace847,96670c052c6ceb2451fb0f2;is_admin=yes")
assert_equal "c84ace847", request.cookies["_session_id"], request.cookies.inspect
assert_equal "yes", request.cookies["is_admin"], request.cookies.inspect
end
@@ -596,7 +596,7 @@ class RequestParamsParsing < BaseRequestTest
"rack.input" => StringIO.new("flamenco=love")
)
- assert_equal({ "flamenco"=> "love" }, request.request_parameters)
+ assert_equal({ "flamenco" => "love" }, request.request_parameters)
end
test "doesnt interpret request uri as query string when missing" do
@@ -774,8 +774,8 @@ class RequestMethod < BaseRequestTest
ensure
# Reset original acronym set
ActiveSupport::Inflector.inflections do |inflect|
- inflect.send(:instance_variable_set,"@acronyms",existing_acrnoyms)
- inflect.send(:instance_variable_set,"@acronym_regex",existing_acrnoym_regex)
+ inflect.send(:instance_variable_set, "@acronyms", existing_acrnoyms)
+ inflect.send(:instance_variable_set, "@acronym_regex", existing_acrnoym_regex)
end
end
end
@@ -1072,14 +1072,14 @@ end
class RequestParameterFilter < BaseRequestTest
test "process parameter filter" do
test_hashes = [
- [{ "foo"=>"bar" },{ "foo"=>"bar" },%w'food'],
- [{ "foo"=>"bar" },{ "foo"=>"[FILTERED]" },%w'foo'],
- [{ "foo"=>"bar", "bar"=>"foo" },{ "foo"=>"[FILTERED]", "bar"=>"foo" },%w'foo baz'],
- [{ "foo"=>"bar", "baz"=>"foo" },{ "foo"=>"[FILTERED]", "baz"=>"[FILTERED]" },%w'foo baz'],
- [{ "bar"=>{ "foo"=>"bar","bar"=>"foo" } },{ "bar"=>{ "foo"=>"[FILTERED]","bar"=>"foo" } },%w'fo'],
- [{ "foo"=>{ "foo"=>"bar","bar"=>"foo" } },{ "foo"=>"[FILTERED]" },%w'f banana'],
- [{ "deep"=>{ "cc"=>{ "code"=>"bar","bar"=>"foo" },"ss"=>{ "code"=>"bar" } } },{ "deep"=>{ "cc"=>{ "code"=>"[FILTERED]","bar"=>"foo" },"ss"=>{ "code"=>"bar" } } },%w'deep.cc.code'],
- [{ "baz"=>[{ "foo"=>"baz" }, "1"] }, { "baz"=>[{ "foo"=>"[FILTERED]" }, "1"] }, [/foo/]]]
+ [{ "foo" => "bar" }, { "foo" => "bar" }, %w'food'],
+ [{ "foo" => "bar" }, { "foo" => "[FILTERED]" }, %w'foo'],
+ [{ "foo" => "bar", "bar" => "foo" }, { "foo" => "[FILTERED]", "bar" => "foo" }, %w'foo baz'],
+ [{ "foo" => "bar", "baz" => "foo" }, { "foo" => "[FILTERED]", "baz" => "[FILTERED]" }, %w'foo baz'],
+ [{ "bar" => { "foo" => "bar", "bar" => "foo" } }, { "bar" => { "foo" => "[FILTERED]", "bar" => "foo" } }, %w'fo'],
+ [{ "foo" => { "foo" => "bar", "bar" => "foo" } }, { "foo" => "[FILTERED]" }, %w'f banana'],
+ [{ "deep" => { "cc" => { "code" => "bar", "bar" => "foo" }, "ss" => { "code" => "bar" } } }, { "deep" => { "cc" => { "code" => "[FILTERED]", "bar" => "foo" }, "ss" => { "code" => "bar" } } }, %w'deep.cc.code'],
+ [{ "baz" => [{ "foo" => "baz" }, "1"] }, { "baz" => [{ "foo" => "[FILTERED]" }, "1"] }, [/foo/]]]
test_hashes.each do |before_filter, after_filter, filter_words|
parameter_filter = ActionDispatch::Http::ParameterFilter.new(filter_words)
@@ -1091,8 +1091,8 @@ class RequestParameterFilter < BaseRequestTest
}
parameter_filter = ActionDispatch::Http::ParameterFilter.new(filter_words)
- before_filter["barg"] = { :bargain=>"gain", "blah"=>"bar", "bar"=>{ "bargain"=>{ "blah"=>"foo" } } }
- after_filter["barg"] = { :bargain=>"niag", "blah"=>"[FILTERED]", "bar"=>{ "bargain"=>{ "blah"=>"[FILTERED]" } } }
+ before_filter["barg"] = { :bargain => "gain", "blah" => "bar", "bar" => { "bargain" => { "blah" => "foo" } } }
+ after_filter["barg"] = { :bargain => "niag", "blah" => "[FILTERED]", "bar" => { "bargain" => { "blah" => "[FILTERED]" } } }
assert_equal after_filter, parameter_filter.filter(before_filter)
end
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 4e547ab7d5..400af42bac 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -131,7 +131,7 @@ class ResponseTest < ActiveSupport::TestCase
def test_only_set_charset_still_defaults_to_text_html
response = ActionDispatch::Response.new
response.charset = "utf-16"
- _,headers,_ = response.to_a
+ _, headers, _ = response.to_a
assert_equal "text/html; charset=utf-16", headers["Content-Type"]
end
@@ -229,7 +229,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))
+ @response.set_cookie("login", value: "foo&bar", path: "/", expires: Time.utc(2005, 10, 10, 5))
_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)
@@ -237,7 +237,7 @@ class ResponseTest < ActiveSupport::TestCase
test "delete 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))
+ @response.set_cookie("login", value: "foo&bar", path: "/", expires: Time.utc(2005, 10, 10, 5))
@response.delete_cookie("login")
assert_equal({ "user_name" => "david", "login" => nil }, @response.cookies)
end
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index c01065932a..92d323f292 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -1933,7 +1933,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
post :preview, on: :new
end
- resource :admin, path_names: { new: "novo" }, path: "administrador" do
+ resource :admin, path_names: { new: "novo" }, path: "administrador" do
post :preview, on: :new
end
@@ -3736,7 +3736,7 @@ private
https!(old_https)
end
- def verify_redirect(url, status=301)
+ def verify_redirect(url, status = 301)
assert_equal status, @response.status
assert_equal url, @response.headers["Location"]
assert_equal expected_redirect_body(url), @response.body
@@ -4163,7 +4163,7 @@ class TestRedirectInterpolation < ActionDispatch::IntegrationTest
end
private
- def verify_redirect(url, status=301)
+ def verify_redirect(url, status = 301)
assert_equal status, @response.status
assert_equal url, @response.headers["Location"]
assert_equal expected_redirect_body(url), @response.body
@@ -4696,15 +4696,15 @@ class TestUrlGenerationErrors < ActionDispatch::IntegrationTest
end
test "url helpers raise message with mixed parameters when generation fails" do
- url, missing = { action: "show", controller: "products", id: nil, "id"=>"url-tested" }, [:id]
+ url, missing = { action: "show", controller: "products", id: nil, "id" => "url-tested" }, [:id]
message = "No route matches #{url.inspect}, possible unmatched constraints: #{missing.inspect}"
# Optimized url helper
- error = assert_raises(ActionController::UrlGenerationError) { product_path(nil, "id"=>"url-tested") }
+ error = assert_raises(ActionController::UrlGenerationError) { product_path(nil, "id" => "url-tested") }
assert_equal message, error.message
# Non-optimized url helper
- error = assert_raises(ActionController::UrlGenerationError, message) { product_path(id: nil, "id"=>"url-tested") }
+ error = assert_raises(ActionController::UrlGenerationError, message) { product_path(id: nil, "id" => "url-tested") }
assert_equal message, error.message
end
end
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb
index aca70e180c..cdb905f298 100644
--- a/actionpack/test/dispatch/static_test.rb
+++ b/actionpack/test/dispatch/static_test.rb
@@ -143,16 +143,16 @@ module StaticTests
assert_equal "Accept-Encoding", response.headers["Vary"]
assert_equal "gzip", response.headers["Content-Encoding"]
- response = get(file_name, "HTTP_ACCEPT_ENCODING" => "Gzip")
- assert_gzip file_name, response
+ response = get(file_name, "HTTP_ACCEPT_ENCODING" => "Gzip")
+ assert_gzip file_name, response
- response = get(file_name, "HTTP_ACCEPT_ENCODING" => "GZIP")
- assert_gzip file_name, response
+ response = get(file_name, "HTTP_ACCEPT_ENCODING" => "GZIP")
+ assert_gzip file_name, response
- response = get(file_name, "HTTP_ACCEPT_ENCODING" => "compress;q=0.5, gzip;q=1.0")
- assert_gzip file_name, response
+ response = get(file_name, "HTTP_ACCEPT_ENCODING" => "compress;q=0.5, gzip;q=1.0")
+ assert_gzip file_name, response
- response = get(file_name, "HTTP_ACCEPT_ENCODING" => "")
+ response = get(file_name, "HTTP_ACCEPT_ENCODING" => "")
assert_not_equal "gzip", response.headers["Content-Encoding"]
end
@@ -166,7 +166,7 @@ module StaticTests
def test_serves_gzip_with_propper_content_type_fallback
file_name = "/gzip/foo.zoo"
response = get(file_name, "HTTP_ACCEPT_ENCODING" => "gzip")
- assert_gzip file_name, response
+ assert_gzip file_name, response
default_response = get(file_name) # no gzip
assert_equal default_response.headers["Content-Type"], response.headers["Content-Type"]
@@ -269,14 +269,14 @@ class StaticTest < ActiveSupport::TestCase
filename = "shared.html.erb"
assert File.exist?(File.join(@root, "..", filename))
env = {
- "REQUEST_METHOD"=>"GET",
- "REQUEST_PATH"=>"/..%2F#{filename}",
- "PATH_INFO"=>"/..%2F#{filename}",
- "REQUEST_URI"=>"/..%2F#{filename}",
- "HTTP_VERSION"=>"HTTP/1.1",
- "SERVER_NAME"=>"localhost",
- "SERVER_PORT"=>"8080",
- "QUERY_STRING"=>""
+ "REQUEST_METHOD" => "GET",
+ "REQUEST_PATH" => "/..%2F#{filename}",
+ "PATH_INFO" => "/..%2F#{filename}",
+ "REQUEST_URI" => "/..%2F#{filename}",
+ "HTTP_VERSION" => "HTTP/1.1",
+ "SERVER_NAME" => "localhost",
+ "SERVER_PORT" => "8080",
+ "QUERY_STRING" => ""
}
assert_equal(DummyApp.call(nil), @app.call(env))
end
diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb
index 60d0246a68..51680216e4 100644
--- a/actionpack/test/dispatch/uploaded_file_test.rb
+++ b/actionpack/test/dispatch/uploaded_file_test.rb
@@ -58,25 +58,25 @@ module ActionDispatch
end
def test_delegates_close_to_tempfile
- tf = Class.new { def close(unlink_now=false); "thunderhorse" end }
+ tf = Class.new { def close(unlink_now = false); "thunderhorse" end }
uf = Http::UploadedFile.new(tempfile: tf.new)
assert_equal "thunderhorse", uf.close
end
def test_close_accepts_parameter
- tf = Class.new { def close(unlink_now=false); "thunderhorse: #{unlink_now}" end }
+ tf = Class.new { def close(unlink_now = false); "thunderhorse: #{unlink_now}" end }
uf = Http::UploadedFile.new(tempfile: tf.new)
assert_equal "thunderhorse: true", uf.close(true)
end
def test_delegates_read_to_tempfile
- tf = Class.new { def read(length=nil, buffer=nil); "thunderhorse" end }
+ tf = Class.new { def read(length = nil, buffer = nil); "thunderhorse" end }
uf = Http::UploadedFile.new(tempfile: tf.new)
assert_equal "thunderhorse", uf.read
end
def test_delegates_read_to_tempfile_with_params
- tf = Class.new { def read(length=nil, buffer=nil); [length, buffer] end }
+ tf = Class.new { def read(length = nil, buffer = nil); [length, buffer] end }
uf = Http::UploadedFile.new(tempfile: tf.new)
assert_equal %w{ thunder horse }, uf.read(*%w{ thunder horse })
end