From 48fd667bda20b899c8c2f0c68a403476f083effc Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Sat, 15 Oct 2005 14:39:29 +0000 Subject: Raise an exception if an attempt is made to insert more session data into the ActiveRecordStore data column than the column can hold. Closes #2234. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2612 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/controller/active_record_store_test.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/active_record_store_test.rb b/actionpack/test/controller/active_record_store_test.rb index 99034880dc..be7f911e70 100644 --- a/actionpack/test/controller/active_record_store_test.rb +++ b/actionpack/test/controller/active_record_store_test.rb @@ -53,6 +53,7 @@ module CommonActiveRecordStoreTests @new_session.close end end + end class ActiveRecordStoreTest < Test::Unit::TestCase @@ -77,6 +78,28 @@ class ActiveRecordStoreTest < Test::Unit::TestCase end end +class ColumnLimitTest < Test::Unit::TestCase + + def setup + @session_class = CGI::Session::ActiveRecordStore::Session + @session_class.create_table! + end + + def teardown + @session_class.drop_table! + end + + def test_protection_from_data_larger_than_column + # Can't test this unless there is a limit + return unless limit = @session_class.data_column_size_limit + too_big = ':(' * limit + s = @session_class.new(:session_id => '666', :data => {'foo' => too_big}) + s.data + assert_raises(ActionController::SessionOverflowError) { s.save } + end + +end + class DeprecatedActiveRecordStoreTest < ActiveRecordStoreTest def setup -- cgit v1.2.3