Sha256: eef552e5cf82aea6e5105e5dfeadde735ef49fe42886d2752fcf2ae8953e183a
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 Bytes
Contents
# frozen_string_literal: true RSpec.shared_examples 'Decodeable Examples' do describe 'decode' do let(:token) do JWT.encode(payload, SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm) end let(:payload) { { sub: 1 } } it 'decodes a json web token' do allow(JWT).to receive(:decode).and_call_original decoded_token = subject.decode(token) aggregate_failures do expect(JWT).to have_received(:decode).with(token, SolidusJwt::Config.jwt_secret, true, hash_including(algorithm: SolidusJwt::Config.jwt_algorithm)) expect(decoded_token).to be_kind_of(Array) expect(decoded_token.first).to include(payload.as_json) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_jwt-1.2.2 | spec/support/shared_examples/decodeable_examples.rb |