diff options
author | Luca Guidi <guidi.luca@gmail.com> | 2009-03-31 16:39:13 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-04-05 21:00:50 +1200 |
commit | 42cdc7571d115c5eb4ece440001d221f24553100 (patch) | |
tree | f11f4cc5861d95ca8ff3621305e428f946481727 /actionpack | |
parent | 0e9efae4745e232b1c778fda69ee110e42a223a7 (diff) | |
download | rails-42cdc7571d115c5eb4ece440001d221f24553100.tar.gz rails-42cdc7571d115c5eb4ece440001d221f24553100.tar.bz2 rails-42cdc7571d115c5eb4ece440001d221f24553100.zip |
Ensure SqlBypass use ActiveRecord::Base connection
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#https://rails.lighthouseapp.com/attachments/106066/0001-Ensure-SqlBypass-use-ActiveRecord-Base-connection.patch state:committed]
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/activerecord/active_record_store_test.rb | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index c98892edc1..34f18806a2 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -45,23 +45,27 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest ActiveRecord::SessionStore.session_class.drop_table! end - def test_setting_and_getting_session_value - with_test_route_set do - get '/set_session_value' - assert_response :success - assert cookies['_session_id'] - - get '/get_session_value' - assert_response :success - assert_equal 'foo: "bar"', response.body - - get '/set_session_value', :foo => "baz" - assert_response :success - assert cookies['_session_id'] - - get '/get_session_value' - assert_response :success - assert_equal 'foo: "baz"', response.body + %w{ session sql_bypass }.each do |class_name| + define_method("test_setting_and_getting_session_value_with_#{class_name}_store") do + with_store class_name do + with_test_route_set do + get '/set_session_value' + assert_response :success + assert cookies['_session_id'] + + get '/get_session_value' + assert_response :success + assert_equal 'foo: "bar"', response.body + + get '/set_session_value', :foo => "baz" + assert_response :success + assert cookies['_session_id'] + + get '/get_session_value' + assert_response :success + assert_equal 'foo: "baz"', response.body + end + end end end @@ -171,4 +175,11 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest yield end end + + def with_store(class_name) + session_class, ActiveRecord::SessionStore.session_class = + ActiveRecord::SessionStore.session_class, "ActiveRecord::SessionStore::#{class_name.camelize}".constantize + yield + ActiveRecord::SessionStore.session_class = session_class + end end |