Sha256: 7ba6f27f0c838c71eda13841ab492761be43f65b82972689edc049a8081a2495

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 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 = FactoryGirl.create(: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 = FactoryGirl.create(: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

6 entries across 6 versions & 1 rubygems

Version Path
minimalist_authentication-0.6.14 test/sessions_test.rb
minimalist_authentication-0.6.12 test/sessions_test.rb
minimalist_authentication-0.6.11 test/sessions_test.rb
minimalist_authentication-0.6.10 test/sessions_test.rb
minimalist_authentication-0.6.9 test/sessions_test.rb
minimalist_authentication-0.6.8 test/sessions_test.rb