2010-05-09 12:44:53 +00:00
|
|
|
### Authentication
|
|
|
|
|
|
|
|
Given /^I am not authenticated$/ do
|
2010-06-10 22:07:59 +00:00
|
|
|
visit('/admin/sign_out')
|
2010-05-09 12:44:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Given /^I am an authenticated user$/ do
|
|
|
|
Given %{I go to login}
|
2010-07-31 08:27:21 +00:00
|
|
|
And %{I fill in "Email" with "admin@locomotiveapp.org"}
|
|
|
|
And %{I fill in "Password" with "easyone"}
|
2010-05-09 12:44:53 +00:00
|
|
|
And %{I press "Log in"}
|
|
|
|
end
|
|
|
|
|
|
|
|
Then /^I am redirected to "([^\"]*)"$/ do |url|
|
|
|
|
assert [301, 302].include?(@integration_session.status), "Expected status to be 301 or 302, got #{@integration_session.status}"
|
|
|
|
location = @integration_session.headers["Location"]
|
|
|
|
assert_equal url, location
|
|
|
|
visit location
|
|
|
|
end
|
|
|
|
|
2010-07-28 10:17:56 +00:00
|
|
|
### Cross-domain authentication
|
|
|
|
|
|
|
|
When /^I forget to press the button on the cross-domain notice page$/ do
|
|
|
|
@admin.updated_at = 2.minutes.ago
|
|
|
|
Mongoid::Persistence::Update.new(@admin).send(:update)
|
|
|
|
end
|
|
|
|
|
|
|
|
### Common
|
2010-05-09 12:44:53 +00:00
|
|
|
|