Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 6: Coerce time no precision test #791

Merged
merged 2 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def type_to_sql(type, limit: nil, precision: nil, scale: nil, **)
if (0..7) === precision
column_type_sql << "(#{precision})"
else
raise(ActiveRecordError, "The dattime2 type has precision of #{precision}. The allowed range of precision is from 0 to 7")
raise(ActiveRecordError, "The datetime2 type has precision of #{precision}. The allowed range of precision is from 0 to 7")
end
end
column_type_sql
Expand Down
3 changes: 3 additions & 0 deletions test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,9 @@ def test_time_precision_is_truncated_on_assignment_coerced
assert_equal 0, foo.start.nsec
assert_equal 123457000, foo.finish.nsec
end

# SQL Server uses default precision for time.
coerce_tests! :test_no_time_precision_isnt_truncated_on_assignment
end


Expand Down