mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test case for average
on the interval column
This commit is contained in:
parent
7f05d8c2af
commit
1a60826c9d
1 changed files with 8 additions and 0 deletions
|
@ -86,6 +86,14 @@ class PostgresqlIntervalTest < ActiveRecord::PostgreSQLTestCase
|
|||
assert_equal "P1DT1H", i.legacy_term
|
||||
end
|
||||
|
||||
def test_average_interval_type
|
||||
IntervalDataType.create!([{ maximum_term: 6.years }, { maximum_term: 4.months }])
|
||||
value = IntervalDataType.average(:maximum_term)
|
||||
|
||||
assert_equal 3.years + 2.months, value
|
||||
assert_instance_of ActiveSupport::Duration, value
|
||||
end
|
||||
|
||||
def test_deprecated_legacy_type
|
||||
assert_deprecated do
|
||||
DeprecatedIntervalDataType.new
|
||||
|
|
Loading…
Reference in a new issue