Skip to content

Commit

Permalink
fixing rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yasonk authored and anakinj committed Feb 4, 2021
1 parent 9d88f62 commit 4fb9a2a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions spec/jwt/verify_spec.rb
Expand Up @@ -228,27 +228,29 @@ module JWT # rubocop:disable Metrics/ModuleLength

context '.verify_claims' do
let(:fail_verifications_options) { { iss: 'mismatched-issuer', aud: 'no-match', sub: 'some subject' } }
let(:fail_verifications_payload) { {
'exp' => (Time.now.to_i - 50),
'jti' => ' ',
'iss' => 'some-issuer',
'nbf' => (Time.now.to_i + 50),
'iat' => 'not a number',
'sub' => 'not-a-match' } }
let(:fail_verifications_payload) {
{
'exp' => (Time.now.to_i - 50),
'jti' => ' ',
'iss' => 'some-issuer',
'nbf' => (Time.now.to_i + 50),
'iat' => 'not a number',
'sub' => 'not-a-match'
}
}

%w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub].each do |method|
let(:payload) { base_payload.merge(fail_verifications_payload) }
it "must skip verification when #{method} option is set to false" do
Verify.verify_claims(payload, options.merge("#{method}" => false))
Verify.verify_claims(payload, options.merge(method => false))
end

it "must raise error when #{method} option is set to true" do
expect do
Verify.verify_claims(payload, options.merge("#{method}" => true).merge(fail_verifications_options))
Verify.verify_claims(payload, options.merge(method => true).merge(fail_verifications_options))
end.to raise_error
end
end

end
end
end

0 comments on commit 4fb9a2a

Please sign in to comment.