diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-01-09 23:33:57 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-01-09 23:33:57 +0100 |
commit | 492d20398681f7d38adac5dc1d3cfb77079e8bcf (patch) | |
tree | fab1078552d5050d396dfc39e1bae30b89959b0d /activerecord/test | |
parent | 2c1ac375c02eddd05616c4cd80b58c9167a02ee3 (diff) | |
download | rails-492d20398681f7d38adac5dc1d3cfb77079e8bcf.tar.gz rails-492d20398681f7d38adac5dc1d3cfb77079e8bcf.tar.bz2 rails-492d20398681f7d38adac5dc1d3cfb77079e8bcf.zip |
Split out token `if` tests to trigger `before_create`.
When running passing condition assertions in the same test the user had already
been saved at that point.
Split out so we have a not yet persisted user.
Rename condition tests to improve clarity a bit.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/secure_token_test.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/test/cases/secure_token_test.rb b/activerecord/test/cases/secure_token_test.rb index ff0072d59c..239b975d82 100644 --- a/activerecord/test/cases/secure_token_test.rb +++ b/activerecord/test/cases/secure_token_test.rb @@ -30,13 +30,17 @@ class SecureTokenTest < ActiveRecord::TestCase assert_equal @user.token, "custom-secure-token" end - def test_token_with_if_condition_checks_condition_on_save + def test_failing_if_condition_does_not_set_token @user.token_condition = false @user.save + assert_nil @user.conditional_token + end + def test_passing_if_condition_sets_token @user.token_condition = true @user.save + assert_not_nil @user.conditional_token end end |