diff options
author | Iain Beeston <iain.beeston@gmail.com> | 2016-10-14 17:21:11 +0100 |
---|---|---|
committer | Iain Beeston <iain.beeston@gmail.com> | 2016-10-15 07:33:22 +0100 |
commit | 894c033843fe93f50bfe47c98a77bb3183988d09 (patch) | |
tree | 73f33f6ffe8d55b5cbe3ea538ce349b075b2c3fb /activemodel/test/cases/type/integer_test.rb | |
parent | 159b774887cfb3d5c862b2b48d24d75b658e47af (diff) | |
download | rails-894c033843fe93f50bfe47c98a77bb3183988d09.tar.gz rails-894c033843fe93f50bfe47c98a77bb3183988d09.tar.bz2 rails-894c033843fe93f50bfe47c98a77bb3183988d09.zip |
Refactored ActiveModel::Type tests into their own files
Diffstat (limited to 'activemodel/test/cases/type/integer_test.rb')
-rw-r--r-- | activemodel/test/cases/type/integer_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/type/integer_test.rb b/activemodel/test/cases/type/integer_test.rb index e00246b602..d81ce189e6 100644 --- a/activemodel/test/cases/type/integer_test.rb +++ b/activemodel/test/cases/type/integer_test.rb @@ -1,5 +1,6 @@ require "cases/helper" require "active_model/type" +require "active_support/core_ext/numeric/time" module ActiveModel module Type @@ -41,6 +42,12 @@ module ActiveModel assert_equal 0, type.serialize(false) end + test "casting duration" do + type = Type::Integer.new + assert_equal 1800, type.cast(30.minutes) + assert_equal 7200, type.cast(2.hours) + end + test "changed?" do type = Type::Integer.new |