From 01434a5ee651972e3ec13cd5a55e32409b17a9e1 Mon Sep 17 00:00:00 2001 From: Attila Domokos Date: Sat, 12 Jan 2013 14:31:33 -0500 Subject: [PATCH] Adding tests for ActiveModel::Model * Verifying persisted? is false when Model initialized * Passing nil to Model should not blow up * Changing test name to the one suggested in pull request comment --- activemodel/test/cases/model_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activemodel/test/cases/model_test.rb b/activemodel/test/cases/model_test.rb index d93fd96b88..588d8e661e 100644 --- a/activemodel/test/cases/model_test.rb +++ b/activemodel/test/cases/model_test.rb @@ -20,7 +20,13 @@ class ModelTest < ActiveModel::TestCase def test_initialize_with_nil_or_empty_hash_params_does_not_explode assert_nothing_raised do BasicModel.new() + BasicModel.new nil BasicModel.new({}) end end + + def test_persisted_is_always_false + object = BasicModel.new(:attr => "value") + assert object.persisted? == false + end end