Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Authentication Test
- require 'test_helper'
- class AuthenticationTest < ActionController::IntegrationTest
- test "valid registration" do
- visit register_path
- fill_in "user[username]", :with => "Foobar"
- fill_in "user[email]", :with => "foo@example.com"
- fill_in "user[password]", :with => "password"
- fill_in "user[password_confirmation]", :with => "password"
- click_button "Sign Up"
- assert_contain "Thank you for registering, and welcome to Project"
- end
- test "invalid registration" do
- visit register_path
- click_button "Sign Up"
- assert_contain "errors prohibited this user from being saved"
- end
- test "valid login" do
- user = Factory(:user, :username => "Foobar", :email => "foo@example.com", :password => "password")
- visit login_path
- fill_in "user_session[username]", :with => "Foobar"
- fill_in "Password", :with => "password"
- click_button "Login"
- assert_contain "Welcome back Foobar."
- end
- test "invalid login" do
- Factory(:user, :username => "Foobar", :email => "foo@example.com", :password => "password")
- visit login_path
- fill_in "user_session[username]", :with => "Foobar"
- fill_in "Password", :with => "wrong_password"
- click_button "Login"
- assert_contain "Wrong username and/or password."
- end
- test "Logout login" do
- Factory(:user, :username => "Foobar", :email => "foo@example.com", :password => "password")
- visit login_path
- fill_in "user_session[username]", :with => "Foobar"
- fill_in "Password", :with => "password"
- click_button "Login"
- click_link "Logout"
- assert_contain "See you later."
- end
- test "Forgot password (pre-reset)" do
- user = Factory(:user, :email => "foobar@example.com")
- visit login_path
- click_link "Forgot Password?"
- fill_in "email", :with => "foobar@example.com"
- click_button "Reset my password"
- assert_contain "Instructions to reset your password have been emailed to you. Please check your email."
- end
- test "Reset password" do
- user = Factory(:user, :perishable_token => "vpPsEI1X-3eVD_1Z2hlZ")
- visit edit_password_reset_path(user.perishable_token)
- fill_in "user[password]", :with => "password"
- fill_in "user[password_confirmation]", :with => "password"
- click_button "Update my password and log me in"
- assert_contain "Password successfully updated"
- end
- end
- ## Error
- $ rake test:integration
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/integration/authentication_test.rb" "test/integration/bibliography_test.rb"
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActionController::IntegrationTests (NameError)
- from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
- from ./test/integration/bibliography_test.rb:3
- from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:147:in `load_without_new_constant_marking'
- from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:147:in `load'
- from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
- from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
- from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
- rake aborted!
Add Comment
Please, Sign In to add comment