Sha256: eeaf7581af59daedc364dcf7b9cf3425aa4efab0a3ba9d538c0998b69ec1eebf
Contents?: true
Size: 981 Bytes
Versions: 2
Compression:
Stored size: 981 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe SolidusJwt::Token, type: :model do subject { instance } let(:instance) { FactoryBot.create(:token) } it { is_expected.to be_valid } it { is_expected.to be_active } it { is_expected.not_to be_expired } context 'when token is nil' do let(:instance) { FactoryBot.build(:token, token: nil) } it 'generates one automatically' do expect(instance.token).to be_nil instance.save expect(instance.token).to be_present end end describe '.honor?' do subject { described_class.honor?(token) } let(:token) { instance.token } it { is_expected.to be true } context 'when token is inactive' do let(:instance) { FactoryBot.create(:token, :inactive) } it { is_expected.to be false } end context 'when token is expired' do let(:instance) { FactoryBot.create(:token, :expired) } it { is_expected.to be false } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_jwt-1.2.1 | spec/models/solidus_jwt/token_spec.rb |
solidus_jwt-1.2.0 | spec/models/solidus_jwt/token_spec.rb |