563d2d1e3d
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.8.0 to 2.9.0. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.8.0...v2.9.0)
34 lines
1.2 KiB
Ruby
34 lines
1.2 KiB
Ruby
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe Session, type: :model do
|
|
|
|
describe 'Check that session creation' do
|
|
context 'without persistent flag in data payload' do
|
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: {}) }
|
|
|
|
it 'does not set the persistent attribute' do
|
|
expect(session.persistent).to be_nil
|
|
end
|
|
end
|
|
|
|
context 'with true persistent flag in data payload' do
|
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => true }) }
|
|
|
|
it 'sets the persistent attribute in the session and removes the persistent attribute from the data payload' do
|
|
expect(session.persistent).to be(true)
|
|
expect(session.persistent).to be(true)
|
|
end
|
|
end
|
|
|
|
context 'with false persistent flag in data payload' do
|
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) }
|
|
|
|
it 'does not set the persistent attribute' do
|
|
expect(session.persistent).to be_nil
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|