Sha256: e6d7a24d13ddda9d90e021aae7d96c289b67afafe20edd3b52f97d2b0f42987f

Contents?: true

Size: 1.66 KB

Versions: 5

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'

# Feature: Sign in
#   As a user
#   I want to sign in
#   So I can visit protected areas of the site
feature 'Sign in', :devise do

  # Scenario: User cannot sign in if not registered
  #   Given I do not exist as a user
  #   When I sign in with valid credentials
  #   Then I see an invalid credentials message
  scenario 'user cannot sign in if not registered' do
    signin('test@example.com', 'please123')
    expect(page).to have_content 'Invalid email or password.'
  end

  # Scenario: User can sign in with valid credentials
  #   Given I exist as a user
  #   And I am not signed in
  #   When I sign in with valid credentials
  #   Then I see a success message
  scenario 'user can sign in with valid credentials' do
    user = FactoryGirl.create(:user)
    signin(user.email, user.password)
    expect(page).to have_content 'Signed in successfully.'
  end

  # Scenario: User cannot sign in with wrong email
  #   Given I exist as a user
  #   And I am not signed in
  #   When I sign in with a wrong email
  #   Then I see an invalid email message
  scenario 'user cannot sign in with wrong email' do
    user = FactoryGirl.create(:user)
    signin('invalid@email.com', user.password)
    expect(page).to have_content 'Invalid email or password.'
  end

  # Scenario: User cannot sign in with wrong password
  #   Given I exist as a user
  #   And I am not signed in
  #   When I sign in with a wrong password
  #   Then I see an invalid password message
  scenario 'user cannot sign in with wrong password' do
    user = FactoryGirl.create(:user)
    signin(user.email, 'invalidpass')
    expect(page).to have_content 'Invalid email or password.'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_apps_pages-0.4.5 lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
rails_apps_pages-0.4.4 lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
rails_apps_pages-0.4.3 lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
rails_apps_pages-0.4.2 lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
rails_apps_pages-0.4.1 lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb