-
Notifications
You must be signed in to change notification settings - Fork 3
[backport] 0.4.0 release from main branch #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d9adde
Set `expires_in` and `race_condition_ttl` options during caching
bdewater 6b0af1c
Use constants for cache keys
bdewater b24e47f
Release 0.4.0
bdewater 3c8bcd4
Merge remote-tracking branch 'origin/main' into nt--backport-0.4.0
nicolastemciuc ee00ca1
test: improve expires_in specs with UTC handling
nicolastemciuc 808beb6
test: reword expires_in test descriptions
nicolastemciuc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,32 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "spec_helper" | ||
| require "fido_metadata/statement" | ||
| require "fido_metadata/table_of_contents" | ||
|
|
||
| RSpec.describe FidoMetadata::TableOfContents do | ||
| let(:file) { File.read(SUPPORT_PATH.join("mds_toc.txt")) } | ||
| let(:current_time) { Time.utc(2019, 12, 28) } | ||
| let(:current_time) { Time.utc(2025, 1, 1, 0, 0, 0) } | ||
|
|
||
| before(:each) do | ||
| allow(Time).to receive(:now).and_return(current_time) | ||
| # Set timezone to UTC for the duration of the tests | ||
| around do |ex| | ||
| orig_tz = ENV["TZ"] | ||
| ENV["TZ"] = "UTC" | ||
| ex.run | ||
| ENV["TZ"] = orig_tz | ||
| end | ||
|
|
||
| subject do | ||
| json, _ = JWT.decode(file, nil, false, algorithms: ["ES256"]) | ||
| described_class.from_json(json) | ||
| before do | ||
| allow(Time).to receive(:now).and_return(current_time) | ||
| end | ||
|
|
||
| it "#expires_in calculates in how much seconds it will expire" do | ||
| expect(subject.expires_in).to eq(9172800) | ||
| describe "#expires_in" do | ||
| it "returns the number of seconds until nextUpdate" do | ||
| toc = described_class.from_json("nextUpdate" => "2025-01-02T00:00:00Z") | ||
| expect(toc.expires_in).to eq(86_400) | ||
| end | ||
|
|
||
| it "can return a negative number when nextUpdate is in the past" do | ||
| toc = described_class.from_json("nextUpdate" => "2024-12-31T23:59:00Z") | ||
| expect(toc.expires_in).to eq(-86_400) | ||
| end | ||
| end | ||
| end | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.