Skip to content

Commit 3d8b95b

Browse files
committed
Remove smoe deprecated usages from tests
1 parent 8d971ea commit 3d8b95b

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

test/db/postgresql/rake_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def do_teardown
5252
test 'rake db:structure:dump and db:structure:load' do
5353
omit('pg_dump not available') unless self.class.which('pg_dump')
5454

55-
initial_format = ActiveRecord::Base.schema_format
56-
ActiveRecord::Base.schema_format = :sql
55+
initial_format = ActiveRecord.schema_format
56+
ActiveRecord.schema_format = :sql
5757
# Rake::Task["db:create"].invoke
5858
create_rake_test_database do |connection|
5959
create_schema_migrations_table(connection)
@@ -85,7 +85,7 @@ def do_teardown
8585
ensure
8686
File.delete(structure_sql) if File.exists?(structure_sql)
8787
Dir.rmdir 'db'
88-
ActiveRecord::Base.schema_format = initial_format
88+
ActiveRecord.schema_format = initial_format
8989
end
9090
end
9191

test/db/postgresql/types_test.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def test_numrange_values
375375

376376
def test_tsrange_values
377377
skip "PostgreSQL 9.2 required for range datatypes" unless supports_ranges?
378-
tz = ::ActiveRecord::Base.default_timezone
378+
tz = ::ActiveRecord.default_timezone
379379
assert_equal Time.send(tz, 2010, 1, 1, 14, 30, 0)..Time.send(tz, 2011, 1, 1, 14, 30, 0), @first_range.ts_range
380380
assert_equal Time.send(tz, 2010, 1, 1, 14, 30, 0)...Time.send(tz, 2011, 1, 1, 14, 30, 0), @second_range.ts_range
381381
assert_equal nil, @empty_range.ts_range
@@ -424,7 +424,7 @@ def test_update_tstzrange
424424

425425
def test_create_tsrange
426426
skip "PostgreSQL 9.2 required for range datatypes" unless supports_ranges?
427-
tz = ::ActiveRecord::Base.default_timezone
427+
tz = ::ActiveRecord.default_timezone
428428
tsrange = Time.send(tz, 2010, 1, 1, 14, 30, 0)...Time.send(tz, 2011, 2, 2, 14, 30, 0)
429429
range = PostgresqlRange.new(:ts_range => tsrange)
430430
assert range.save
@@ -434,7 +434,7 @@ def test_create_tsrange
434434

435435
def test_update_tsrange
436436
skip "PostgreSQL 9.2 required for range datatypes" unless supports_ranges?
437-
tz = ::ActiveRecord::Base.default_timezone
437+
tz = ::ActiveRecord.default_timezone
438438
new_tsrange = Time.send(tz, 2010, 1, 1, 14, 30, 0)...Time.send(tz, 2011, 2, 2, 14, 30, 0)
439439
assert @first_range.ts_range = new_tsrange
440440
assert @first_range.save
@@ -682,36 +682,36 @@ def test_update_oid
682682

683683
def test_timestamp_with_zone_values_with_rails_time_zone_support
684684
old_tz = ActiveRecord::Base.time_zone_aware_attributes
685-
old_default_tz = ActiveRecord::Base.default_timezone
685+
old_default_tz = ActiveRecord.default_timezone
686686

687687
ActiveRecord::Base.time_zone_aware_attributes = true
688-
ActiveRecord::Base.default_timezone = :utc
688+
ActiveRecord.default_timezone = :utc
689689

690690
@connection.reconnect!
691691

692692
@first_timestamp_with_zone = PostgresqlTimestampWithZone.find(1)
693693
assert_equal Time.utc(2010,1,1, 11,0,0), @first_timestamp_with_zone.time
694694
assert_instance_of Time, @first_timestamp_with_zone.time
695695
ensure
696-
ActiveRecord::Base.default_timezone = old_default_tz
696+
ActiveRecord.default_timezone = old_default_tz
697697
ActiveRecord::Base.time_zone_aware_attributes = old_tz
698698
@connection.reconnect!
699699
end
700700

701701
def test_timestamp_with_zone_values_without_rails_time_zone_support
702702
old_tz = ActiveRecord::Base.time_zone_aware_attributes
703-
old_default_tz = ActiveRecord::Base.default_timezone
703+
old_default_tz = ActiveRecord.default_timezone
704704

705705
ActiveRecord::Base.time_zone_aware_attributes = false
706-
ActiveRecord::Base.default_timezone = :local
706+
ActiveRecord.default_timezone = :local
707707

708708
@connection.reconnect!
709709

710710
@first_timestamp_with_zone = PostgresqlTimestampWithZone.find(1)
711711
assert_equal Time.utc(2010,1,1, 11,0,0), @first_timestamp_with_zone.time
712712
assert_instance_of Time, @first_timestamp_with_zone.time
713713
ensure
714-
ActiveRecord::Base.default_timezone = old_default_tz
714+
ActiveRecord.default_timezone = old_default_tz
715715
ActiveRecord::Base.time_zone_aware_attributes = old_tz
716716
@connection.reconnect!
717717
end

test/db/sqlite3/simple_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,15 @@ def test_custom_select_datetime
260260
my_time = Time.utc 2013, 03, 15, 19, 53, 51, 0 # usec
261261
model = DbType.create! :sample_datetime => my_time
262262
model = DbType.where("id = #{model.id}").select('sample_datetime AS custom_sample_datetime').first
263-
assert_match my_time.to_s(:db), model.custom_sample_datetime # '2013-03-15 18:53:51.000000'
263+
assert_match my_time.to_fs(:db), model.custom_sample_datetime # '2013-03-15 18:53:51.000000'
264264
end
265265

266266
# @override SQLite3 JDBC returns VARCHAR type for column
267267
def test_custom_select_date
268268
my_date = Time.local(2000, 01, 30, 0, 0, 0, 0).to_date
269269
model = DbType.create! :sample_date => my_date
270270
model = DbType.where("id = #{model.id}").select('sample_date AS custom_sample_date').first
271-
assert_equal my_date.to_s(:db), model.custom_sample_date
271+
assert_equal my_date.to_fs(:db), model.custom_sample_date
272272
end
273273

274274
# @override

0 commit comments

Comments
 (0)