Sha256: f1eefb75d99a1d63c4c3c56d8e1be236243979c6aff8b29a4c6f1810b5512779

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

Given /^I am signed in(?: as an? (.*))?$/ do |role|
  role ||= 'user'
  role = role.strip

  user = Factory(role)
  Given %{I sign in as "#{user.email}/#{user.password}"}
end

Then /^I should see a list of users$/ do
  page.should have_css('tbody tr', :count => 20)
end

# Database

Given /^a user exists with the attrubutes:$/ do |fields|
  user = Factory :user, fields.rows_hash
end

Given /^I sign in as a (.+)$/ do |role|
  user = create_model(role).first
  user.confirm_email!
  Given %{I sign in as "#{user.email}\/#{user.password}"}
end

# Actions

When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
  When %{I go to the sign in page}
  And %{I fill in "user_email" with "#{email}"}
  And %{I fill in "user_password" with "#{password}"}
  And %{I press "Sign in"}
end

When /^I sign out$/ do
  visit destroy_user_session_path
end

Then /^the user should (not )?be able to sign in as "(.*)\/(.*)"$/ do |yes_no, email, password|
  Given %{I sign out}
  And %{I sign in as "#{email}/#{password}"}
  if yes_no.blank?
    Then %{I should see "Signed in successfully"}
  else
    Then %{I should see "Invalid email or password."}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noodall-devise-0.0.1 features/step_definitions/user_steps.rb