aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/session/cookie_store_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-26 12:56:53 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-26 12:56:53 -0500
commit0c638b340685b0bd1020bef2cd8a6d221058aa78 (patch)
treef8e7b403aaf194a2116650474f25046fe013054c /actionpack/test/dispatch/session/cookie_store_test.rb
parentdb65bb5a31dc91f9c74dc310425a42ece489b74e (diff)
downloadrails-0c638b340685b0bd1020bef2cd8a6d221058aa78.tar.gz
rails-0c638b340685b0bd1020bef2cd8a6d221058aa78.tar.bz2
rails-0c638b340685b0bd1020bef2cd8a6d221058aa78.zip
Clean up session integration tests so they don't reference AC::Dispatcher
Diffstat (limited to 'actionpack/test/dispatch/session/cookie_store_test.rb')
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb25
1 files changed, 6 insertions, 19 deletions
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index d695be0be4..366a14168b 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -46,10 +46,6 @@ class CookieStoreTest < ActionController::IntegrationTest
def rescue_action(e) raise end
end
- def setup
- reset_app!
- end
-
def test_raises_argument_error_if_missing_session_key
assert_raise(ArgumentError, nil.inspect) {
ActionDispatch::Session::CookieStore.new(nil,
@@ -193,10 +189,7 @@ class CookieStoreTest < ActionController::IntegrationTest
end
def test_session_store_with_expire_after
- with_test_route_set do
- app = ActionDispatch::Session::CookieStore.new(ActionController::Dispatcher.new, :key => SessionKey, :secret => SessionSecret, :expire_after => 5.hours)
- @integration_session = open_session(app)
-
+ with_test_route_set(:expire_after => 5.hours) do
# First request accesses the session
time = Time.local(2008, 4, 24)
Time.stubs(:now).returns(time)
@@ -226,20 +219,14 @@ class CookieStoreTest < ActionController::IntegrationTest
end
private
- def reset_app!
- app = ActionDispatch::Session::CookieStore.new(ActionController::Dispatcher.new,
- :key => SessionKey, :secret => SessionSecret)
- @integration_session = open_session(app)
- end
-
- def with_test_route_set
+ def with_test_route_set(options = {})
with_routing do |set|
set.draw do |map|
- map.with_options :controller => "cookie_store_test/test" do |c|
- c.connect "/:action"
- end
+ map.connect "/:action", :controller => "cookie_store_test/test"
end
- reset_app!
+ options = {:key => SessionKey, :secret => SessionSecret}.merge(options)
+ app = ActionDispatch::Session::CookieStore.new(set, options)
+ @integration_session = open_session(app)
yield
end
end