Skip to content

Commit 51d0818

Browse files
committed
Remove workarounds for old Rubies
1 parent 6f89d22 commit 51d0818

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

test/cases/coerced_tests.rb

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,40 +1948,8 @@ class SchemaCacheTest < ActiveRecord::TestCase
19481948
# Tests fail on Windows AppVeyor CI with 'Permission denied' error when renaming file during `File.atomic_write` call.
19491949
coerce_tests! :test_yaml_dump_and_load, :test_yaml_dump_and_load_with_gzip if RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
19501950

1951-
# Ruby 2.5 and 2.6 have issues to marshal Time before 1900. 2012.sql has one column with default value 1753
1952-
coerce_tests! :test_marshal_dump_and_load_with_gzip, :test_marshal_dump_and_load_via_disk
1953-
1954-
# Tests fail on Windows AppVeyor CI with 'Permission denied' error when renaming file during `File.atomic_write` call.
1955-
unless RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
1956-
def test_marshal_dump_and_load_with_gzip_coerced
1957-
with_marshable_time_defaults { original_test_marshal_dump_and_load_with_gzip }
1958-
end
1959-
def test_marshal_dump_and_load_via_disk_coerced
1960-
with_marshable_time_defaults { original_test_marshal_dump_and_load_via_disk }
1961-
end
1962-
end
1963-
19641951
private
19651952

1966-
def with_marshable_time_defaults
1967-
# Detect problems
1968-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7")
1969-
column = @connection.columns(:sst_datatypes).find { |c| c.name == "datetime" }
1970-
current_default = column.default if column.default.is_a?(Time) && column.default.year < 1900
1971-
end
1972-
1973-
# Correct problems
1974-
if current_default.present?
1975-
@connection.change_column_default(:sst_datatypes, :datetime, current_default.dup.change(year: 1900))
1976-
end
1977-
1978-
# Run original test
1979-
yield
1980-
ensure
1981-
# Revert changes
1982-
@connection.change_column_default(:sst_datatypes, :datetime, current_default) if current_default.present?
1983-
end
1984-
19851953
# We need to give the full paths for this to work.
19861954
undef_method :schema_dump_5_1_path
19871955
def schema_dump_5_1_path

0 commit comments

Comments
 (0)