Sha256: da11f006f7d9c7783e30be7cf5921b8816456d10f11a74be3a07a6877642a06a
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 Bytes
Contents
# frozen_string_literal: true RSpec.shared_examples 'Encodeable Examples' do describe 'encode' do let(:payload) { { user_id: 1 } } it 'encodes a json web token' do allow(JWT).to receive(:encode).and_call_original token = subject.encode(payload: payload) expect(JWT).to have_received(:encode).with(hash_including('iat', 'user_id' => 1), SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm) expect(token).to be_kind_of String end context 'when expiration is passed in' do it 'encodes a json web token with expiration date' do allow(JWT).to receive(:encode).and_call_original token = subject.encode(payload: payload, expires_in: 60) expect(JWT).to have_received(:encode).with(hash_including('iat', 'exp', 'user_id' => 1), SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm) expect(token).to be_kind_of String end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_jwt-1.2.1 | spec/support/shared_examples/encodeable_examples.rb |
solidus_jwt-1.2.0 | spec/support/shared_examples/encodeable_examples.rb |