diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-19 01:44:01 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-19 01:44:01 -0800 |
commit | 5b0fc1a007522e9d41faf364f74426be2b9e3f63 (patch) | |
tree | 2e5620fdfb2a0043208b5b4f3c90c8d35dd10031 /activerecord | |
parent | a3ebe7f3a741fee71c419a0774adb28bd9de0e8e (diff) | |
parent | f8b4110f009a8d509f0350da4c1388c5a5bb4a2d (diff) | |
download | rails-5b0fc1a007522e9d41faf364f74426be2b9e3f63.tar.gz rails-5b0fc1a007522e9d41faf364f74426be2b9e3f63.tar.bz2 rails-5b0fc1a007522e9d41faf364f74426be2b9e3f63.zip |
Merge pull request #13393 from matthewd/fix_pg_range_tests
Fix PostgreSQL range tests on fresh DB
Correcting the name of the table we're creating is self-explanatory.
But we must also move away from the low IDs, because we're not touching the freshly-created primary key sequence; when the time comes, @new_range will be assigned an ID of 1.
Diffstat (limited to 'activerecord')
-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 |