Skip to content

Commit f8a3318

Browse files
RenzoMinelliclaude
andcommitted
test: check pending? after consume and after expiry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 34ddab9 commit f8a3318

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎spec/devise/webauthn/challenge_stores/cache_spec.rb‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
described_class.cache = original_cache
2323
end
2424

25+
# rubocop:disable RSpec/MultipleExpectations
2526
it "finds the challenge through the credential's client data and consumes it once" do
2627
store.write(:passkey_authentication, challenge)
2728

2829
expect(store.pending?(:passkey_authentication)).to be(true)
2930
expect(store.consume(:passkey_authentication)).to eq(challenge)
31+
expect(store.pending?(:passkey_authentication)).to be(false)
3032
expect(store.consume(:passkey_authentication)).to be_nil
3133
end
34+
# rubocop:enable RSpec/MultipleExpectations
3235

3336
it "keys the cache entry by a digest of the challenge" do
3437
allow(described_class.cache).to receive(:write).and_call_original
@@ -50,6 +53,7 @@
5053
store.write(:passkey_authentication, challenge)
5154

5255
travel_to(described_class.expires_in.from_now + 1.second) do
56+
expect(store.pending?(:passkey_authentication)).to be(false)
5357
expect(store.consume(:passkey_authentication)).to be_nil
5458
end
5559
end

0 commit comments

Comments
 (0)