Skip to content

Commit 62e6a4c

Browse files
BuonOmorafiss
authored andcommitted
fix: rework outdated tests
1 parent 4a897b4 commit 62e6a4c

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

test/cases/defaults_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class DefaultExpressionTest < ActiveRecord::TestCase
1515
output = dump_table_schema("defaults")
1616

1717
assert_match %r/t\.date\s+"modified_date",\s+default: -> { \"current_date\(\)\" }/, output
18-
assert_match %r/t\.datetime\s+"modified_time",\s+precision: nil,\s+default: -> { "current_timestamp\(\)" }/, output
18+
assert_match %r/t\.datetime\s+"modified_time",\s+default: -> { "current_timestamp\(\)" }/, output
1919

2020
assert_match %r/t\.date\s+"modified_date_function",\s+default: -> { "now\(\)" }/, output
21-
assert_match %r/t\.datetime\s+"modified_time_function",\s+precision: nil,\s+default: -> { "now\(\)" }/, output
21+
assert_match %r/t\.datetime\s+"modified_time_function",\s+default: -> { "now\(\)" }/, output
2222
end
2323
end
2424

test/cases/migration/change_schema_test.rb

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -127,40 +127,6 @@ def test_create_table_with_limits
127127
assert_equal "bigint", eight.sql_type
128128
end
129129

130-
def test_add_column_with_postgresql_datetime_type
131-
connection.create_table :testings do |t|
132-
t.column :foo, :datetime
133-
end
134-
135-
column = connection.columns(:testings).find { |c| c.name == "foo" }
136-
137-
assert_equal :datetime, column.type
138-
139-
if current_adapter?(:PostgreSQLAdapter)
140-
assert_equal "timestamp without time zone", column.sql_type
141-
elsif current_adapter?(:Mysql2Adapter)
142-
sql_type = supports_datetime_with_precision? ? "datetime(6)" : "datetime"
143-
assert_equal sql_type, column.sql_type
144-
else
145-
assert_equal connection.type_to_sql("datetime(6)"), column.sql_type
146-
end
147-
end
148-
149-
if current_adapter?(:PostgreSQLAdapter)
150-
def test_add_column_with_datetime_in_timestamptz_mode
151-
with_cockroachdb_datetime_type(:timestamptz) do
152-
connection.create_table :testings do |t|
153-
t.column :foo, :datetime
154-
end
155-
156-
column = connection.columns(:testings).find { |c| c.name == "foo" }
157-
158-
assert_equal :datetime, column.type
159-
assert_equal "timestamp with time zone", column.sql_type
160-
end
161-
end
162-
end
163-
164130
private
165131
def testing_table_with_only_foo_attribute
166132
connection.create_table :testings, id: false do |t|

test/excludes/ActiveRecord/Migration/ChangeSchemaTest.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@
55
exclude :test_drop_table_if_exists, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
66
exclude :test_change_column_null, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
77
exclude :test_keeping_default_and_notnull_constraints_on_change, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
8-
exclude :test_add_column_with_postgresql_datetime_type, "Re-implement our own version"
9-
exclude :test_add_column_with_datetime_in_timestamptz_mode, "We need to use an Adapter specific method in this test"

0 commit comments

Comments
 (0)