Created
November 16, 2010 22:31
-
-
Save chadmoone/702650 to your computer and use it in GitHub Desktop.
just testing this out.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Users" do | |
describe "signup" do | |
describe "failure" do | |
it "should not make a new user" do | |
lambda do | |
visit signup_path | |
fill_in "Name", :with => "" | |
fill_in "Email", :with => "" | |
fill_in "Password", :with => "" | |
fill_in "Confirmation", :with => "" | |
click_button | |
response.should render_template('users/new') | |
response.should have_selector('div#error_explaination') | |
end.should_not change(User, :count) | |
end | |
end | |
describe "success" do | |
it "should make a new user" do | |
lambda do | |
visit signup_path | |
fill_in "Name", :with => "Test User" | |
fill_in "Email", :with => "[email protected]" | |
fill_in "Password", :with => "foobar" | |
fill_in "Confirmation", :with => "foobar" | |
click_button | |
response.should have_selector('div.flash.success', :content => "Welcome") | |
response.should render_template('users/show') | |
response.should have_selector('div.success') | |
end.should change(User, :count).by(1) | |
end | |
end | |
end | |
describe "signin" do | |
describe "failure" do | |
it "should not sign a user in" do | |
visit signin_path | |
fill_in "Email", :with => "" | |
fill_in "Password", :with => "" | |
click_button | |
response.should have_selector('div.flash.error', :content => "Invalid") | |
response.should render_template('sessions/new') | |
end | |
end | |
describe "success" do | |
it "should should sign a use in and out" do | |
user = Factory(:user) | |
visit signin_path | |
fill_in "Email", :with => user.email | |
fill_in "Password", :with => user.password | |
click_button | |
controller.should be_signed_in | |
click_link "Sign out" | |
controller.should_not be_signed_in | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment