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-2.9.2 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.9.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.9.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.8.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.7.2 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.7.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.6.2 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.6.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.6.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.5.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.4.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.3.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.3.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.2.1 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.2.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.1.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.0.0 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.0.0.beta2 spec/clearance/default_sign_in_guard_spec.rb
clearance-2.0.0.beta1 spec/clearance/default_sign_in_guard_spec.rb
clearance-1.17.0 spec/clearance/default_sign_in_guard_spec.rb