Sha256: 1882eb29c432b2e7bdd25ee617d15fec4d84c41fab52a886745aa0a8e5c4b899

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require 'helper'

class SessionsControllerTest < ActionController::TestCase
  tests SessionsController
  
  context "The sessions controller" do
    setup do
      @user = Factory(:user, :username => 'sessions-user-test')
    end
    
    should "have a login page" do
      get :new
      assert_response :success
    end
    
    should "be able to login" do
      Challah::Session.any_instance.stubs(:save).returns(true)
      
      post :create, :username => 'sessions-user-test', :password => 'abc123'
      assert_redirected_to '/'
      
      Challah::Session.any_instance.unstub(:save)
    end
    
    should "send you back to the sign in page if you can't sign in" do
      Challah::Session.any_instance.stubs(:save).returns(false)
      
      post :create, :username => 'sessions-user-test', :password => 'abc123'
      assert_redirected_to '/login'
      
      Challah::Session.any_instance.unstub(:save)
    end 
    
    should "be able to sign out" do
      get :destroy
      
      assert_redirected_to '/login'
    end 
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
challah-0.5.2 test/sessions_controller_test.rb
challah-0.5.1 test/sessions_controller_test.rb
challah-0.5.0 test/sessions_controller_test.rb
challah-0.4.1 test/sessions_controller_test.rb
challah-0.4.0 test/sessions_controller_test.rb
challah-0.3.5 test/sessions_controller_test.rb
challah-0.3.4 test/sessions_controller_test.rb
challah-0.3.3 test/sessions_controller_test.rb
challah-0.3.2 test/sessions_controller_test.rb
challah-0.3.1 test/sessions_controller_test.rb