I'm new to Watir and I've having a little trouble getting logged in in my tests. I use authlogic as my authentication method of choice. When a User registers, they are sent an email with a confirmation link. Clicking
this link confirms their account and they can then login.
The issue I'm having is how do I confirm the User when using Watir?
I have so far:
Given /I sign up/ do
BROWSER.goto("http://localhost:3000/register")
BROWSER.text_field(:id, "user_email").set("
[email protected]")
BROWSER.text_field(:id, "user_name").set("Foo Bar)
BROWSER.text_field(:id, "user_password").set("foo bar")
BROWSER.text_field(:id, "user_password_confirmation").set("foo bar")
BROWSER.button(:id, "user_submit").click
end
Given /I am logged in via Watir/ do
BROWSER.goto("http://localhost:3000/login")
BROWSER.text_field(:id, "user_session_email").set("
[email protected])
BROWSER.text_field(:id, "user_session_password").set("foo bar")
BROWSER.button(:id, "user_session_submit").click
end
This correctly populates the fields and the User is saved. Now I try to confirm the User like so:
Given /I am confirmed/ do
User.last.confirmed!
end
Unfortunately
this doesn't work. What am I missing?