Sha256: 344ab449bc66899cdaf3aab4a3ebdb31836163fc9ed5d02aa1504144c785930b

Contents?: true

Size: 753 Bytes

Versions: 39

Compression:

Stored size: 753 Bytes

Contents

require 'spec_helper'

describe Clearance::DefaultSignInGuard do
  context 'session is signed in' do
    it 'returns success' do
      session = double("Session", signed_in?: true)
      guard = Clearance::DefaultSignInGuard.new(session)

      expect(guard.call).to be_a Clearance::SuccessStatus
    end
  end

  context 'session is not signed in' do
    it 'returns failure' do
      session = double("Session", signed_in?: false)
      guard = Clearance::DefaultSignInGuard.new(session)

      response = guard.call

      expect(response).to be_a Clearance::FailureStatus
      expect(response.failure_message).to eq default_failure_message
    end
  end

  def default_failure_message
    I18n.t('flashes.failure_after_create').html_safe
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
clearance-1.16.2 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.16.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.16.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.15.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.15.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.14.2 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.14.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.14.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.13.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.12.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.12.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.11.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.10.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.9.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.8.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.8.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.7.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.6.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.6.0 spec/clearance/default_sign_in_guard_spec.rb