Sha256: 311665ded22db8eb9c6828cc4fb75f2a0fbd6d55bd3ce3ef2999294aef942e6b

Contents?: true

Size: 957 Bytes

Versions: 7

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

describe PUNK::ClearSessionAction do
  context 'with no session provided' do
    it 'returns a validation error' do
      view = described_class.run.result.render(:json)
      expect(view).to match('session is not present')
      expect(view).to match('session is empty')
    end
  end

  context 'with an inactive session provided' do
    it 'returns a validation error' do
      session = create(:session)
      view = described_class.run(session: session).result.render(:json)
      expect(view).to match('session is not in active state')
      expect(view).to match('session may not clear')
    end
  end

  context 'with an active session provided' do
    it 'clears the session' do
      session = create(:session, state: :active)
      view = described_class.run(session: session).result.render(:json)
      expect(view).to match('You have been logged out')
      expect(session.deleted?).to be(true)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
punk-0.3.6 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.3.5 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.3.4 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.3.3 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.3.2 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.3.1 spec/actions/sessions/punk/clear_session_action_spec.rb
punk-0.2.0 spec/actions/sessions/punk/clear_session_action_spec.rb