Permalink
Browse files

Fixed tests and error message.

  • Loading branch information...
1 parent e1b8969 commit 5f6d4d200fbeab23f1466ed4ed4a80924815365a @lvterry committed Apr 14, 2012
@@ -10,7 +10,8 @@ def create
session[:user_id] = @user.id
redirect_to root_url, :notice => 'Logged in.'
else
- flash.now.alert = "Invalid email or password"
+ #flash.now.alert = "Invalid email or password"
+ flash[:alert] = "Invalid email or password."
render :new
end
end
View
@@ -5,7 +5,7 @@
resources 'users'
resources 'sessions'
- get 'login' => 'sessions#create', :as => 'login'
+ get 'login' => 'sessions#new', :as => 'login'
get 'logout' => 'sessions#destroy', :as => 'logout'
# The priority is based upon order of creation:
@@ -1,6 +1,9 @@
require 'test_helper'
class ArticlesControllerTest < ActionController::TestCase
+ def setup
+ session[:user_id] = users(:one).id
+ end
test "should get index" do
get :index
assert_response :success
@@ -9,7 +9,7 @@ class UsersControllerTest < ActionController::TestCase
end
test "should create user" do
- post :create, :user => {:email => 'test@user.com', :password => '123', :password_confirmation => '123'}
+ post :create, :user => {:email => 'test@user.com', :name => 'dave', :password => '123', :password_confirmation => '123'}
assert_redirected_to root_url
assert_equal "Account created and you are logged in.", flash[:notice]
end

0 comments on commit 5f6d4d2

Please sign in to comment.