Sha256: fc4008e349305fa87996533c8d0cfdf03590a45864a746055816f3bca2c58d50

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe CASino::LogoutListener do
  include Rails.application.routes.url_helpers
  let(:controller) { Struct.new(:cookies).new(cookies: {}) }
  let(:listener) { described_class.new(controller) }

  describe '#user_logged_out' do
    let(:url) { 'http://www.example.com/test' }
    it 'assigns the url' do
      listener.user_logged_out(url)
      controller.instance_variable_get(:@url).should == url
    end

    it 'deletes an existing ticket-granting ticket cookie' do
      controller.cookies = { tgt: 'TGT-12345' }
      listener.user_logged_out(url)
      controller.cookies[:tgt].should be_nil
    end

    context 'with redirect_immediately flag' do
      before(:each) do
        controller.stub(:redirect_to)
      end

      it 'tells the controller to redirect the client' do
        controller.should_receive(:redirect_to).with(url, status: :see_other)
        listener.user_logged_out(url, true)
      end

      it 'deletes an existing ticket-granting ticket cookie' do
        controller.cookies = { tgt: 'TGT-12345' }
        listener.user_logged_out(url, true)
        controller.cookies[:tgt].should be_nil
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
casino-3.0.4 spec/controllers/listener/logout_spec.rb
casino-2.0.7 spec/controllers/listener/logout_spec.rb
casino-3.0.3 spec/controllers/listener/logout_spec.rb
casino-3.0.2 spec/controllers/listener/logout_spec.rb
casino-3.0.1 spec/controllers/listener/logout_spec.rb
casino-3.0.0 spec/controllers/listener/logout_spec.rb
casino-3.0.0.pre.2 spec/controllers/listener/logout_spec.rb
casino-3.0.0.pre.1 spec/controllers/listener/logout_spec.rb
casino-2.0.6 spec/controllers/listener/logout_spec.rb
casino-2.0.5 spec/controllers/listener/logout_spec.rb
casino-2.0.4 spec/controllers/listener/logout_spec.rb
casino-2.0.3 spec/controllers/listener/logout_spec.rb
casino-2.0.2 spec/controllers/listener/logout_spec.rb
casino-2.0.1 spec/controllers/listener/logout_spec.rb
casino-2.0.0 spec/controllers/listener/logout_spec.rb