Sha256: ecf3a5855cba7f8bdcbc00fcf61d76a3afc78ed5d8d1391a977aaa746b79f914

Contents?: true

Size: 757 Bytes

Versions: 9

Compression:

Stored size: 757 Bytes

Contents

require 'test_helper'

class SessionsControllerTest < ActionController::TestCase
  
  test "should get new" do
    get :new
    assert_response :success
  end
  
  test "should create session" do
    user = Factory(:user)
    post :create, :email => 'test@testing.com', :password => 'password'
    assert_equal(user.id, session[:user_id])
    assert_redirected_to '/'
  end
  
  test "should fail to create session" do
    user = Factory(:user)
    post :create, :email => 'test@testing.com', :password => 'wrong_password'
    assert_nil(session[:user_id])
    assert_response :success
  end
  
  test "should destroy session" do
    @request.session[:user_id] = 1
    delete :destroy
    assert_nil(session[:user_id])
    assert_redirected_to '/'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minimalist_authentication-0.6.7 test/sessions_test.rb
minimalist_authentication-0.6.6 test/sessions_test.rb
minimalist_authentication-0.6.5 test/sessions_test.rb
minimalist_authentication-0.6.4 test/sessions_test.rb
minimalist_authentication-0.6.3 test/sessions_test.rb
minimalist_authentication-0.6.2 test/sessions_test.rb
minimalist_authentication-0.6.1 test/sessions_test.rb
minimalist_authentication-0.6 test/sessions_test.rb
minimalist_authentication-0.5 test/sessions_test.rb