Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'spec_helper'
  2.  
  3. describe "Sign in process" do
  4.   before(:each) do
  5.     @user = User.create!(:email => 'user@example.com', :password => 'somepass', :password_confirmation => 'somepass')
  6.   end
  7.  
  8.   it "confirmed user should sign in with correct credentials" do
  9.     @user.confirm!
  10.     visit new_user_session_path
  11.     within("#user_new") do
  12.       fill_in 'Email', :with => 'user@example.com'
  13.       fill_in 'Пароль', :with => 'somepass'
  14.     end
  15.     click_button 'Войти'
  16.     page.should have_content 'Выйти'
  17.     page.should_not have_content 'Войти'
  18.   end
  19.  
  20.   it "unconfirmed user should not sign in with correct credentials" do
  21.     visit new_user_session_path
  22.     within("#user_new") do
  23.       fill_in 'Email', :with => 'user@example.com'
  24.       fill_in 'Пароль', :with => 'somepass'
  25.     end
  26.     click_button 'Войти'
  27.     page.should have_content 'Войти'
  28.     page.should_not have_content 'Выйти'
  29.   end
  30. end