Skip to content

Commit 0f9779e

Browse files
authored
Rails 6: Coerce time no precision test (#791)
* Coerce test as time has default precision * Fixed typo
1 parent 0fac1db commit 0f9779e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def type_to_sql(type, limit: nil, precision: nil, scale: nil, **)
236236
if (0..7) === precision
237237
column_type_sql << "(#{precision})"
238238
else
239-
raise(ActiveRecordError, "The dattime2 type has precision of #{precision}. The allowed range of precision is from 0 to 7")
239+
raise(ActiveRecordError, "The datetime2 type has precision of #{precision}. The allowed range of precision is from 0 to 7")
240240
end
241241
end
242242
column_type_sql

test/cases/coerced_tests.rb

+3
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,9 @@ def test_time_precision_is_truncated_on_assignment_coerced
11401140
assert_equal 0, foo.start.nsec
11411141
assert_equal 123457000, foo.finish.nsec
11421142
end
1143+
1144+
# SQL Server uses default precision for time.
1145+
coerce_tests! :test_no_time_precision_isnt_truncated_on_assignment
11431146
end
11441147

11451148

0 commit comments

Comments
 (0)