diff options
author | Matthew Draper <matthew@trebex.net> | 2013-12-19 13:27:45 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2013-12-19 13:34:46 +1030 |
commit | f8b4110f009a8d509f0350da4c1388c5a5bb4a2d (patch) | |
tree | 79e48d9da59bc0e495897f1b70e9fdbb528e28e4 | |
parent | c454fc29a89e2e67ffc94de72062a189aed49b53 (diff) | |
download | rails-f8b4110f009a8d509f0350da4c1388c5a5bb4a2d.tar.gz rails-f8b4110f009a8d509f0350da4c1388c5a5bb4a2d.tar.bz2 rails-f8b4110f009a8d509f0350da4c1388c5a5bb4a2d.zip |
Fix PostgreSQL range tests
The changes in c4044b2 meant the tests would error on a fresh DB.
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/range_test.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/range_test.rb b/activerecord/test/cases/adapters/postgresql/range_test.rb index f58f66d79e..a56b8ac791 100644 --- a/activerecord/test/cases/adapters/postgresql/range_test.rb +++ b/activerecord/test/cases/adapters/postgresql/range_test.rb @@ -16,7 +16,7 @@ if ActiveRecord::Base.connection.supports_ranges? @connection = ActiveRecord::Base.connection begin @connection.transaction do - @connection.create_table('json_data_type') do |t| + @connection.create_table('postgresql_ranges') do |t| t.daterange :date_range t.numrange :num_range t.tsrange :ts_range @@ -29,7 +29,7 @@ if ActiveRecord::Base.connection.supports_ranges? return skip "do not test on PG without range" end - insert_range(id: 1, + insert_range(id: 101, date_range: "[''2012-01-02'', ''2012-01-04'']", num_range: "[0.1, 0.2]", ts_range: "[''2010-01-01 14:30'', ''2011-01-01 14:30'']", @@ -37,7 +37,7 @@ if ActiveRecord::Base.connection.supports_ranges? int4_range: "[1, 10]", int8_range: "[10, 100]") - insert_range(id: 2, + insert_range(id: 102, date_range: "(''2012-01-02'', ''2012-01-04'')", num_range: "[0.1, 0.2)", ts_range: "[''2010-01-01 14:30'', ''2011-01-01 14:30'')", @@ -45,7 +45,7 @@ if ActiveRecord::Base.connection.supports_ranges? int4_range: "(1, 10)", int8_range: "(10, 100)") - insert_range(id: 3, + insert_range(id: 103, date_range: "(''2012-01-02'',]", num_range: "[0.1,]", ts_range: "[''2010-01-01 14:30'',]", @@ -53,7 +53,7 @@ if ActiveRecord::Base.connection.supports_ranges? int4_range: "(1,]", int8_range: "(10,]") - insert_range(id: 4, + insert_range(id: 104, date_range: "[,]", num_range: "[,]", ts_range: "[,]", @@ -61,7 +61,7 @@ if ActiveRecord::Base.connection.supports_ranges? int4_range: "[,]", int8_range: "[,]") - insert_range(id: 5, + insert_range(id: 105, date_range: "(''2012-01-02'', ''2012-01-02'')", num_range: "(0.1, 0.1)", ts_range: "(''2010-01-01 14:30'', ''2010-01-01 14:30'')", @@ -70,11 +70,11 @@ if ActiveRecord::Base.connection.supports_ranges? int8_range: "(10, 10)") @new_range = PostgresqlRange.new - @first_range = PostgresqlRange.find(1) - @second_range = PostgresqlRange.find(2) - @third_range = PostgresqlRange.find(3) - @fourth_range = PostgresqlRange.find(4) - @empty_range = PostgresqlRange.find(5) + @first_range = PostgresqlRange.find(101) + @second_range = PostgresqlRange.find(102) + @third_range = PostgresqlRange.find(103) + @fourth_range = PostgresqlRange.find(104) + @empty_range = PostgresqlRange.find(105) end def test_data_type_of_range_types |