Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + '/../test_helper'
- # grab our HomeController because we're going to test it
- require 'users_controller'
- # Raise errors beyond the default web-based presentation
- class UsersController; def rescue_action(e) raise e end; end
- class UsersControllerTest < ActionController::TestCase
- def setup
- @controller = UsersController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
- def test__login
- get :login
- assert_response :success
- assert_template 'login'
- end
- def test_process_login_of_valid_user
- get :process_login, :user => {:username => "costa", :password => "secret"}
- assert_not_nil session[:id]
- assert_response :redirect
- end
- def test_process_login_of_invalid_user
- #post :process_login, :user => {:username => "bob", :password => "secret"}
- #assert_response :redirect
- #assert_nil session[:id]
- end
- def test_unauthenticated_access
- get :my_account
- assert_response :redirect
- end
- end
Add Comment
Please, Sign In to add comment