2019-08-22 06:57:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe JSONWebToken::Token do
|
2016-05-09 15:06:32 -04:00
|
|
|
let(:token) { described_class.new }
|
|
|
|
|
|
|
|
context 'custom parameters' do
|
|
|
|
let(:value) { 'value' }
|
2017-06-14 14:18:56 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
token[:key] = value
|
|
|
|
end
|
2016-05-09 15:06:32 -04:00
|
|
|
|
|
|
|
it { expect(token[:key]).to eq(value) }
|
|
|
|
it { expect(token.payload).to include(key: value) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'embeds default payload' do
|
|
|
|
subject { token.payload }
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2016-05-09 15:06:32 -04:00
|
|
|
let(:default) { token.send(:default_payload) }
|
|
|
|
|
|
|
|
it { is_expected.to include(default) }
|
|
|
|
end
|
|
|
|
end
|