Here's part of an integration test that I'm having:
user = User.first
assert !user.is_active?
get confirm_email_user_url(user),:confirmId => user.mail_confirmation_hash
assert_equal response.status,200
# because confirm_email_user_url modifies the activation state of the object
user = User.first
assert_equal user.state,"activated"
I spent the last hour debugging this :). In my initial version, I wasn't reinitializing user
after confirm_email_user_url was accessed, and the state was always inactive
even though the user was activated.
How do I know if I should "reload" ( lacking of a better name ) my model object? What should I call in order to do so?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…