Sha256: 34ba24b1e9c9c8414e0847ebe88881abddd60a79a2cefc0da93792896a72f5e1

Contents?: true

Size: 881 Bytes

Versions: 39

Compression:

Stored size: 881 Bytes

Contents

require 'spec_helper'

module Clearance
  describe SignInGuard do
    it 'handles success' do
      sign_in_guard = SignInGuard.new(double("session"))
      status = double("status")
      allow(SuccessStatus).to receive(:new).and_return(status)

      expect(sign_in_guard.success).to eq(status)
    end

    it 'handles failure' do
      sign_in_guard = SignInGuard.new(double("session"))
      status = double("status")
      failure_message = "Failed"
      allow(FailureStatus).to receive(:new).
        with(failure_message).
        and_return(status)

      expect(sign_in_guard.failure(failure_message)).to eq(status)
    end

    it 'can proceed to the next guard' do
      guards = double("guards", call: true)
      sign_in_guard = SignInGuard.new(double("session"), guards)
      sign_in_guard.next_guard
      expect(guards).to have_received(:call)
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
clearance-2.9.2 spec/clearance/sign_in_guard_spec.rb
clearance-2.9.1 spec/clearance/sign_in_guard_spec.rb
clearance-2.9.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.8.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.7.2 spec/clearance/sign_in_guard_spec.rb
clearance-2.7.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.6.2 spec/clearance/sign_in_guard_spec.rb
clearance-2.6.1 spec/clearance/sign_in_guard_spec.rb
clearance-2.6.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.5.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.4.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.3.1 spec/clearance/sign_in_guard_spec.rb
clearance-2.3.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.2.1 spec/clearance/sign_in_guard_spec.rb
clearance-2.2.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.1.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.0.0 spec/clearance/sign_in_guard_spec.rb
clearance-2.0.0.beta2 spec/clearance/sign_in_guard_spec.rb
clearance-2.0.0.beta1 spec/clearance/sign_in_guard_spec.rb
clearance-1.17.0 spec/clearance/sign_in_guard_spec.rb