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-1.16.2 spec/clearance/sign_in_guard_spec.rb
clearance-1.16.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.16.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.15.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.15.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.14.2 spec/clearance/sign_in_guard_spec.rb
clearance-1.14.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.14.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.13.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.12.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.12.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.11.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.10.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.9.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.8.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.8.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.7.0 spec/clearance/sign_in_guard_spec.rb
clearance-1.6.1 spec/clearance/sign_in_guard_spec.rb
clearance-1.6.0 spec/clearance/sign_in_guard_spec.rb