Skip to content

Instantly share code, notes, and snippets.

@alexclarkofficial
Created October 11, 2013 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexclarkofficial/6928105 to your computer and use it in GitHub Desktop.
Save alexclarkofficial/6928105 to your computer and use it in GitHub Desktop.
test
require 'spec_helper'
describe "Authentication" do
subject { page }
describe "signin" do
before { visit root_path }
it { should have_button('Sign in') }
describe "with invalid information" do
before { click_button "Sign in" }
it { should have_selector('div.alert.alert-error', text: 'Please enter a valid username or email') }
end
describe "with valid username" do
let(:user) { FactoryGirl.create(:user) }
before do
fill_in "Username or email", with: user.name
fill_in "Password", with: user.password
click_button "Sign in"
end
it { should redirect_to @user }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment