aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-10-15 14:39:29 +0000
committerMarcel Molina <marcel@vernix.org>2005-10-15 14:39:29 +0000
commit48fd667bda20b899c8c2f0c68a403476f083effc (patch)
tree7ef50bcc0a06ecac3eb4adfa5ed0c8a9f6aaa88c /actionpack/test
parent6a8b9484a7398f3b500cd1f056cbe46fd7d6301c (diff)
downloadrails-48fd667bda20b899c8c2f0c68a403476f083effc.tar.gz
rails-48fd667bda20b899c8c2f0c68a403476f083effc.tar.bz2
rails-48fd667bda20b899c8c2f0c68a403476f083effc.zip
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
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/active_record_store_test.rb23
1 files changed, 23 insertions, 0 deletions
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