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/big_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/big_integer_test.rb')
-rw-r--r-- | activemodel/test/cases/type/big_integer_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activemodel/test/cases/type/big_integer_test.rb b/activemodel/test/cases/type/big_integer_test.rb new file mode 100644 index 0000000000..db1d215083 --- /dev/null +++ b/activemodel/test/cases/type/big_integer_test.rb @@ -0,0 +1,24 @@ +require "cases/helper" +require "active_model/type" + +module ActiveModel + module Type + class BigIntegerTest < ActiveModel::TestCase + def test_type_cast_big_integer + type = Type::BigInteger.new + assert_equal 1, type.cast(1) + assert_equal 1, type.cast("1") + end + + def test_small_values + type = Type::BigInteger.new + assert_equal -9999999999999999999999999999999, type.serialize(-9999999999999999999999999999999) + end + + def test_large_values + type = Type::BigInteger.new + assert_equal 9999999999999999999999999999999, type.serialize(9999999999999999999999999999999) + end + end + end +end |