Sha256: 71e5ae244797abc65385e7b2d13f053c02a5ca7e62df5aa2f7dd9ecfe50a8067

Contents?: true

Size: 1.14 KB

Versions: 45

Compression:

Stored size: 1.14 KB

Contents

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

  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

45 entries across 45 versions & 2 rubygems

Version Path
noodall-form-builder-0.5.4 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.5.3 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.5.2 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.5.0 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.4.2 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.4.1 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.4.0 features/step_definitions/sign_in_steps.rb
noodall-0.2.0 lib/noodall/templates/features/step_definitions/sign_in_steps.rb
noodall-0.2.0.pre.2 lib/noodall/templates/features/step_definitions/sign_in_steps.rb
noodall-0.2.0.pre.1 lib/noodall/templates/features/step_definitions/sign_in_steps.rb
noodall-0.1.0 lib/noodall/templates/features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.3.3 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.2.11 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.3.2 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.3.1 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.3.0 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.2.10 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.2.9 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.2.8 features/step_definitions/sign_in_steps.rb
noodall-form-builder-0.2.7 features/step_definitions/sign_in_steps.rb