Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/app/interactors/admin/tokens/regenerate_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def generate_new_token?

def create_new_token
copy = token.dup
copy.blacklisted_at = nil
copy.iat = Time.zone.now.to_i
copy.save
copy
Expand Down
6 changes: 6 additions & 0 deletions site/spec/organizers/admin/tokens/ban_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
expect(new_token.iat).to be_within(5).of(Time.zone.now.to_i)
end

it 'does not blacklist the newly generated token' do
subject
new_token = Token.where.not(id: token.id).order(created_at: :desc).first
expect(new_token.blacklisted_at).to be_nil
end

it 'sends emails to demandeur and contact technique' do
expect { subject }.to have_enqueued_job(ActionMailer::MailDeliveryJob).at_least(2).times
end
Expand Down