aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-08-29 00:24:52 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-08-29 00:24:52 -0700
commitf84fc39e2ad4195a7002d92c9bb7ead78f3d57b2 (patch)
tree9cb2cd77a04211048636455c136cbfb6e0c08e0a /actionpack
parent58d35f62110d4280818d49f6a76b3bdaa1ee217a (diff)
parent728e925735d6532d1acd586f9dde30c499f91344 (diff)
downloadrails-f84fc39e2ad4195a7002d92c9bb7ead78f3d57b2.tar.gz
rails-f84fc39e2ad4195a7002d92c9bb7ead78f3d57b2.tar.bz2
rails-f84fc39e2ad4195a7002d92c9bb7ead78f3d57b2.zip
Merge pull request #7474 from steveklabnik/backport_89ebd28
Backport 89ebd28 to 3-2-stable
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/testing/test_request.rb2
-rw-r--r--actionpack/test/dispatch/test_request_test.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/test_request.rb b/actionpack/lib/action_dispatch/testing/test_request.rb
index 7280e9a93b..cf789dc901 100644
--- a/actionpack/lib/action_dispatch/testing/test_request.rb
+++ b/actionpack/lib/action_dispatch/testing/test_request.rb
@@ -12,7 +12,7 @@ module ActionDispatch
end
def initialize(env = {})
- env = Rails.application.env_config.merge(env) if defined?(Rails.application)
+ env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
super(DEFAULT_ENV.merge(env))
self.host = 'test.host'
diff --git a/actionpack/test/dispatch/test_request_test.rb b/actionpack/test/dispatch/test_request_test.rb
index 4ee1d61146..6047631ba3 100644
--- a/actionpack/test/dispatch/test_request_test.rb
+++ b/actionpack/test/dispatch/test_request_test.rb
@@ -55,6 +55,13 @@ class TestRequestTest < ActiveSupport::TestCase
assert_cookies({"user_name" => "david"}, req.cookie_jar)
end
+ test "does not complain when Rails.application is nil" do
+ Rails.stubs(:application).returns(nil)
+ req = ActionDispatch::TestRequest.new
+
+ assert_equal false, req.env.empty?
+ end
+
private
def assert_cookies(expected, cookie_jar)
assert_equal(expected, cookie_jar.instance_variable_get("@cookies"))