aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/type/integer_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-17 21:44:15 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-17 21:44:15 +0900
commit25b3cbb241a334d750eed24f5094151e52ed7c69 (patch)
treec7160d55ae25f7d21ee13e5997eed1f929838848 /activemodel/test/cases/type/integer_test.rb
parent78d23d820a91c1259ff28ee2ba1b5b99263694ff (diff)
downloadrails-25b3cbb241a334d750eed24f5094151e52ed7c69.tar.gz
rails-25b3cbb241a334d750eed24f5094151e52ed7c69.tar.bz2
rails-25b3cbb241a334d750eed24f5094151e52ed7c69.zip
Add edge test cases for integer and string types
Diffstat (limited to 'activemodel/test/cases/type/integer_test.rb')
-rw-r--r--activemodel/test/cases/type/integer_test.rb7
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 df12098974..9bd0110099 100644
--- a/activemodel/test/cases/type/integer_test.rb
+++ b/activemodel/test/cases/type/integer_test.rb
@@ -50,6 +50,13 @@ module ActiveModel
assert_equal 7200, type.cast(2.hours)
end
+ test "casting empty string" do
+ type = Type::Integer.new
+ assert_nil type.cast("")
+ assert_nil type.serialize("")
+ assert_equal 0, type.deserialize("")
+ end
+
test "changed?" do
type = Type::Integer.new