From db41f33d7c9ec436b78d2eb3afa96c9afcc9cca5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 8 Jul 2015 15:59:30 -0700 Subject: make `env` a required parameter --- actionpack/lib/action_dispatch/testing/test_request.rb | 2 +- actionpack/test/dispatch/test_request_test.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_dispatch/testing/test_request.rb b/actionpack/lib/action_dispatch/testing/test_request.rb index b40da46703..0d712f0592 100644 --- a/actionpack/lib/action_dispatch/testing/test_request.rb +++ b/actionpack/lib/action_dispatch/testing/test_request.rb @@ -10,7 +10,7 @@ module ActionDispatch "rack.request.cookie_hash" => {}.with_indifferent_access ) - def initialize(env = {}) + def initialize(env) env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application super(default_env.merge(env)) end diff --git a/actionpack/test/dispatch/test_request_test.rb b/actionpack/test/dispatch/test_request_test.rb index a4c124070a..5613d4a879 100644 --- a/actionpack/test/dispatch/test_request_test.rb +++ b/actionpack/test/dispatch/test_request_test.rb @@ -2,7 +2,7 @@ require 'abstract_unit' class TestRequestTest < ActiveSupport::TestCase test "sane defaults" do - env = ActionDispatch::TestRequest.new.env + env = ActionDispatch::TestRequest.new({}).env assert_equal "GET", env.delete("REQUEST_METHOD") assert_equal "off", env.delete("HTTPS") @@ -27,7 +27,7 @@ class TestRequestTest < ActiveSupport::TestCase end test "cookie jar" do - req = ActionDispatch::TestRequest.new + req = ActionDispatch::TestRequest.new({}) assert_equal({}, req.cookies) assert_equal nil, req.env["HTTP_COOKIE"] @@ -55,13 +55,13 @@ class TestRequestTest < ActiveSupport::TestCase test "does not complain when Rails.application is nil" do Rails.stubs(:application).returns(nil) - req = ActionDispatch::TestRequest.new + req = ActionDispatch::TestRequest.new({}) assert_equal false, req.env.empty? end test "default remote address is 0.0.0.0" do - req = ActionDispatch::TestRequest.new + req = ActionDispatch::TestRequest.new({}) assert_equal '0.0.0.0', req.remote_addr end @@ -71,7 +71,7 @@ class TestRequestTest < ActiveSupport::TestCase end test "default host is test.host" do - req = ActionDispatch::TestRequest.new + req = ActionDispatch::TestRequest.new({}) assert_equal 'test.host', req.host end @@ -81,7 +81,7 @@ class TestRequestTest < ActiveSupport::TestCase end test "default user agent is 'Rails Testing'" do - req = ActionDispatch::TestRequest.new + req = ActionDispatch::TestRequest.new({}) assert_equal 'Rails Testing', req.user_agent end -- cgit v1.2.3