aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 10:59:59 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 10:59:59 -0300
commit6442c90f098f7095ada0cd66bb7291b6798a5583 (patch)
tree1d4df68e7784018a658a1405cb0838ff34fac7d6 /actionpack/test/controller/integration_test.rb
parent9598c9655f04b3bf6dfc245437ad5a09f23c792c (diff)
parent95333e131708d0500e03e3ed1b076f4817f04fbb (diff)
downloadrails-6442c90f098f7095ada0cd66bb7291b6798a5583.tar.gz
rails-6442c90f098f7095ada0cd66bb7291b6798a5583.tar.bz2
rails-6442c90f098f7095ada0cd66bb7291b6798a5583.zip
Merge pull request #18298 from brainopia/integration_requests_without_setup
Integration requests should work in contexts without setup and teardown
Diffstat (limited to 'actionpack/test/controller/integration_test.rb')
-rw-r--r--actionpack/test/controller/integration_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index d6219b7626..5535c7ae78 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -850,3 +850,27 @@ class IntegrationWithRoutingTest < ActionDispatch::IntegrationTest
end
end
end
+
+# to work in contexts like rspec before(:all)
+class IntegrationRequestsWithoutSetup < ActionDispatch::IntegrationTest
+ self._setup_callbacks = []
+ self._teardown_callbacks = []
+
+ class FooController < ActionController::Base
+ def ok
+ cookies[:key] = 'ok'
+ render plain: 'ok'
+ end
+ end
+
+ def test_request
+ with_routing do |routes|
+ routes.draw { get ':action' => FooController }
+ get '/ok'
+
+ assert_response 200
+ assert_equal 'ok', response.body
+ assert_equal 'ok', cookies['key']
+ end
+ end
+end