提交 492d2039 编写于 作者: K Kasper Timm Hansen

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.
上级 2c1ac375
......@@ -30,13 +30,17 @@ def test_token_value_not_overwritten_when_present
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册