Skip to content

Commit 6335f5e

Browse files
committed
Return truthy value on success
1 parent b9ee8b6 commit 6335f5e

File tree

5 files changed

+5
-1
lines changed

5 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Notable changes in the upcoming **version 3.0**:
3232

3333
**Fixes and enhancements:**
3434

35+
- Return truthy value for `::JWT::ClaimsValidator#validate!` and `::JWT::Verify.verify_claims` [#628](https://github.com/jwt/ruby-jwt/pull/628) ([@anakinj](https://github.com/anakinj))
3536
- Your contribution here
3637

3738
## [v2.9.2](https://github.com/jwt/ruby-jwt/tree/v2.9.2) (2024-10-03)

lib/jwt/claims_validator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def initialize(payload)
1010

1111
def validate!
1212
Claims.verify_payload!(@payload, :numeric)
13+
true
1314
end
1415
end
1516
end

lib/jwt/verify.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class << self
1616

1717
def verify_claims(payload, options)
1818
::JWT::Claims.verify!(payload, options)
19+
true
1920
end
2021
end
2122

spec/jwt/claims_validator_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
context "when #{claim} payload is an integer" do
1111
let(:claims) { { claim => 12_345 } }
1212

13+
it { is_expected.to be_truthy }
1314
it 'does not raise error' do
1415
expect { subject }.not_to raise_error
1516
end

spec/jwt/verify_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def issuer_start_with_ruby?(issuer)
310310
%w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub].each do |method|
311311
let(:payload) { base_payload.merge(fail_verifications_payload) }
312312
it "must skip verification when #{method} option is set to false" do
313-
described_class.verify_claims(payload, options.merge(method => false))
313+
expect(described_class.verify_claims(payload, options.merge(method => false))).to be_truthy
314314
end
315315

316316
it "must raise error when #{method} option is set to true" do

0 commit comments

Comments
 (0)