[#10799] Move api entreprise token logic in a concern
This commit is contained in:
parent
39fdb8ddbb
commit
7009eed9d7
5 changed files with 72 additions and 20 deletions
|
@ -24,7 +24,7 @@ RSpec.describe 'administrateurs/procedures/_api_entreprise_token_expiration_aler
|
|||
end
|
||||
end
|
||||
|
||||
context "when the token is valid it should display the expiration date" do
|
||||
context "when the token expires in few days it should display the expiration date" do
|
||||
let(:expiration) { 2.days.from_now }
|
||||
let(:api_entreprise_token) { JWT.encode({ exp: expiration.to_i }, nil, "none") }
|
||||
|
||||
|
@ -34,4 +34,14 @@ RSpec.describe 'administrateurs/procedures/_api_entreprise_token_expiration_aler
|
|||
expect(rendered).to have_content("Votre jeton API Entreprise expirera le\n#{expiration.strftime('%d/%m/%Y à %H:%M')}")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the token expires in a long time" do
|
||||
let(:expiration) { 2.months.from_now }
|
||||
let(:api_entreprise_token) { JWT.encode({ exp: expiration.to_i }, nil, "none") }
|
||||
|
||||
it "does not render anything" do
|
||||
subject
|
||||
expect(rendered).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue