Sha256: 27ae214ddd2f6a2cc863f40a0f826951e52ecb683e089d6953776acc08843b3b

Contents?: true

Size: 1008 Bytes

Versions: 15

Compression:

Stored size: 1008 Bytes

Contents

require 'helper'

class SessionsControllerTest < ActionController::TestCase
  tests SessionsController

  context "The sessions controller" do
    setup do
      @user = create(:user, :username => 'sessions-user-test')
    end

    should "have a sign-in page" do
      get :new
      assert_response :success
    end

    should "be able to sign in" 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 '/sign-in'

      Challah::Session.any_instance.unstub(:save)
    end

    should "be able to sign out" do
      get :destroy

      assert_redirected_to '/sign-in'
    end
  end
end

Version data entries

15 entries across 14 versions & 2 rubygems

Version Path
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/test/sessions_controller_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/test/sessions_controller_test.rb
challah-0.8.3 test/sessions_controller_test.rb
challah-0.8.2 test/sessions_controller_test.rb
challah-0.8.1 test/sessions_controller_test.rb
challah-0.8.0 test/sessions_controller_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/test/sessions_controller_test.rb
challah-0.8.0.pre test/sessions_controller_test.rb
challah-0.7.1 test/sessions_controller_test.rb
challah-0.7.0 test/sessions_controller_test.rb
challah-0.7.0.pre2 test/sessions_controller_test.rb
challah-0.7.0.pre test/sessions_controller_test.rb
challah-0.6.2 test/sessions_controller_test.rb
challah-0.6.1 test/sessions_controller_test.rb
challah-0.6.0 test/sessions_controller_test.rb