Sha256: aed969bbb1f90e1c7163a82222fff5235779182be0e35a04906b7a0f289a5dea
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# frozen_string_literal: true describe BrowseEverythingSession::ProviderSession do subject(:provider_session) { described_class.new(session: session, name: name) } let(:session) { instance_double(ActionDispatch::Request::Session) } let(:name) { 'test_session' } describe '.for' do it 'provides a new session object' do expect(described_class.for(session: session, name: name)).to be_a described_class end end describe '.token' do before do allow(session).to receive(:[]=) allow(session).to receive(:[]).and_return('test-token') provider_session.token = 'test-token' end it 'sets and accesses the access token' do expect(provider_session.token).to eq 'test-token' expect(session).to have_received(:[]).with('test_session_token') end end describe '.code' do before do allow(session).to receive(:[]=) allow(session).to receive(:[]).and_return('test-code') provider_session.code = 'test-code' end it 'sets and accesses the access code' do expect(provider_session.code).to eq 'test-code' expect(session).to have_received(:[]).with('test_session_code') end end describe '.data' do before do allow(session).to receive(:[]=) allow(session).to receive(:[]).and_return('test' => 'data') provider_session.data = { 'test' => 'data' } end it 'sets and accesses the access data' do expect(provider_session.data).to eq('test' => 'data') expect(session).to have_received(:[]).with('test_session_data') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
browse-everything-0.16.0 | spec/services/browse_everything_session/provider_session_spec.rb |