-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #851 from agrare/move_fix_expires_at_to_shared_helper
Move fix_token_expries_at to spec/support (cherry picked from commit a31f0c8)
- Loading branch information
Showing
2 changed files
with
14 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def fix_token_expires_at_interaction(interaction) | ||
return unless interaction.request.uri.end_with?("v3/auth/tokens") | ||
|
||
data = JSON.parse(interaction.response.body) | ||
return if data.dig("token", "expires_at").nil? | ||
|
||
data["token"]["expires_at"] = "9999-12-31T23:59:59.999999Z" | ||
interaction.response.body = data.to_json.force_encoding('ASCII-8BIT') | ||
end | ||
|
||
def fix_token_expires_at(config) | ||
config.before_record { |interaction| fix_token_expires_at_interaction(interaction) } | ||
end |