diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-08-31 22:11:50 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-31 22:11:50 +0100 |
commit | bae00bb1cc392e1cf408369809b9cf85468bef42 (patch) | |
tree | 17103af6eeb5de96c72beda1debce28950cc7fea /actionpack/test/activerecord | |
parent | 93c76b2fb08668bc4b8364cc8051476e6d1d15ba (diff) | |
parent | ffd2cf167040b60c26d97c01598560c87bd4b2d3 (diff) | |
download | rails-bae00bb1cc392e1cf408369809b9cf85468bef42.tar.gz rails-bae00bb1cc392e1cf408369809b9cf85468bef42.tar.bz2 rails-bae00bb1cc392e1cf408369809b9cf85468bef42.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/test/activerecord')
-rw-r--r-- | actionpack/test/activerecord/active_record_store_test.rb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index 47f8496181..a46ce7a0aa 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -1,12 +1,6 @@ require 'active_record_unit' class ActiveRecordStoreTest < ActionController::IntegrationTest - DispatcherApp = ActionController::Dispatcher.new - SessionApp = ActiveRecord::SessionStore.new(DispatcherApp, - :key => '_session_id') - SessionAppWithFixation = ActiveRecord::SessionStore.new(DispatcherApp, - :key => '_session_id', :cookie_only => false) - class TestController < ActionController::Base def no_session_access head :ok @@ -39,7 +33,7 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest def setup ActiveRecord::SessionStore.session_class.create_table! - @integration_session = open_session(SessionApp) + reset_app! end def teardown @@ -138,9 +132,9 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest end def test_allows_session_fixation - @integration_session = open_session(SessionAppWithFixation) - with_test_route_set do + reset_with_fixation! + get '/set_session_value' assert_response :success assert cookies['_session_id'] @@ -151,8 +145,7 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest session_id = cookies['_session_id'] assert session_id - reset! - @integration_session = open_session(SessionAppWithFixation) + reset_with_fixation! get '/set_session_value', :_session_id => session_id, :foo => "baz" assert_response :success @@ -166,6 +159,16 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest end private + def reset_app! + app = ActiveRecord::SessionStore.new(ActionController::Dispatcher.new, :key => '_session_id') + @integration_session = open_session(app) + end + + def reset_with_fixation! + app = ActiveRecord::SessionStore.new(ActionController::Dispatcher.new, :key => '_session_id', :cookie_only => false) + @integration_session = open_session(app) + end + def with_test_route_set with_routing do |set| set.draw do |map| |