diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-20 13:54:10 -0600 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-20 14:04:51 -0600 |
commit | 8daaff5dac0725c5cf62811ac4a67b21f62aca2f (patch) | |
tree | 4b1089aae88cabc4d24e7adf7b001f8e830611d7 /activerecord/test/cases | |
parent | 96838b5192e46caecc73cf45968fd27b78a41404 (diff) | |
download | rails-8daaff5dac0725c5cf62811ac4a67b21f62aca2f.tar.gz rails-8daaff5dac0725c5cf62811ac4a67b21f62aca2f.tar.bz2 rails-8daaff5dac0725c5cf62811ac4a67b21f62aca2f.zip |
hstores can cycle
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/hstore_test.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index 7267536142..e03c938a25 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -45,9 +45,33 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase end def test_create - hash = { 'a' => 'b', '1' => '2' } + assert_cycle_hstore('a' => 'b', '1' => '2') + end + + def test_quotes + assert_cycle_hstore('a' => 'b"ar', '1"foo' => '2') + end + + def test_whitespace + assert_cycle_hstore('a b' => 'b ar', '1"foo' => '2') + end + + def test_backslash + assert_cycle_hstore('a\\b' => 'b\\ar', '1"foo' => '2') + end + + def test_comma + assert_cycle_hstore('a, b' => 'bar', '1"foo' => '2') + end + + def test_arrow + assert_cycle_hstore('a=>b' => 'bar', '1"foo' => '2') + end + + private + def assert_cycle_hstore hash x = Hstore.create!(:tags => hash) x.reload - assert_equal hash, x.tags + assert_equal(hash, x.tags) end end |