aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/model_test.rb
diff options
context:
space:
mode:
authorAttila Domokos <adomokos@gmail.com>2013-01-12 14:31:33 -0500
committerAttila Domokos <adomokos@gmail.com>2013-01-12 20:04:24 -0500
commit01434a5ee651972e3ec13cd5a55e32409b17a9e1 (patch)
tree594ca1fab78d1348dcf4b56ab523eabd0d6c37b4 /activemodel/test/cases/model_test.rb
parent6581d798e830a7820dd54fe95d40014c0e2057fe (diff)
downloadrails-01434a5ee651972e3ec13cd5a55e32409b17a9e1.tar.gz
rails-01434a5ee651972e3ec13cd5a55e32409b17a9e1.tar.bz2
rails-01434a5ee651972e3ec13cd5a55e32409b17a9e1.zip
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
Diffstat (limited to 'activemodel/test/cases/model_test.rb')
-rw-r--r--activemodel/test/cases/model_test.rb6
1 files changed, 6 insertions, 0 deletions
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