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
This commit is contained in:
Attila Domokos 2013-01-12 14:31:33 -05:00
parent 6581d798e8
commit 01434a5ee6
1 changed files with 6 additions and 0 deletions

View File

@ -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