diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-17 11:37:43 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-17 11:37:43 -0800 |
commit | 504ed9095810c40b0967802dfbdd347c7e3a4e89 (patch) | |
tree | 25f8549cd5e8af165cc6bd821d8906d1506f022c /activerecord/test/cases/adapters | |
parent | cc74088c6cd4da7d3ce7bc0d66c4cae509693622 (diff) | |
parent | 49182b87b258786ae5942eeb475618794291e976 (diff) | |
download | rails-504ed9095810c40b0967802dfbdd347c7e3a4e89.tar.gz rails-504ed9095810c40b0967802dfbdd347c7e3a4e89.tar.bz2 rails-504ed9095810c40b0967802dfbdd347c7e3a4e89.zip |
Merge pull request #8542 from le0pard/fixed_ar_intrange
AR supporting new int4range and int8range data type on PostgreSQL >= 9.2. Fix #8528 pull request
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/intrange_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/intrange_test.rb b/activerecord/test/cases/adapters/postgresql/intrange_test.rb index affacd092a..58628cebc8 100644 --- a/activerecord/test/cases/adapters/postgresql/intrange_test.rb +++ b/activerecord/test/cases/adapters/postgresql/intrange_test.rb @@ -84,4 +84,21 @@ class PostgresqlIntrangesTest < ActiveRecord::TestCase assert_equal(nil, x.int_range) end -end + def test_invalid_intrange + assert IntRangeDataType.create!(int_range: ('a'..'d')) + x = IntRangeDataType.first + assert_equal(nil, x.int_range) + end + + def test_save_empty_range + assert IntRangeDataType.create!(int_range: (nil..nil)) + x = IntRangeDataType.first + assert_equal((nil..nil), x.int_range) + end + + def test_save_invalid_data + assert_raises(ActiveRecord::StatementInvalid) do + IntRangeDataType.create!(int_range: "empty1") + end + end +end
\ No newline at end of file |