Skip to content

Commit

Permalink
Adding tests for ActiveModel::Model
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
adomokos committed Jan 13, 2013
1 parent 6581d79 commit 01434a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions activemodel/test/cases/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ def test_initialize_with_params
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

0 comments on commit 01434a5

Please sign in to comment.