Fix typo in share worker

This commit is contained in:
Karina Kwiatek 2023-01-02 09:36:28 +01:00
parent 0241a02e29
commit 873d6a2c88
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ class ShareWorker
logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the account is suspended." logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the account is suspended."
rescue Twitter::Error::Unauthorized rescue Twitter::Error::Unauthorized
# User's Twitter token has expired or been revoked # User's Twitter token has expired or been revoked
logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the token has exired or been revoked." logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the token has expired or been revoked."
revoke_and_notify(user_id, service) revoke_and_notify(user_id, service)
rescue => e rescue => e
logger.info "failed to post answer #{answer_id} to #{service} for user #{user_id}: #{e.message}" logger.info "failed to post answer #{answer_id} to #{service} for user #{user_id}: #{e.message}"

View File

@ -56,7 +56,7 @@ describe ShareWorker do
allow_any_instance_of(Services::Twitter).to receive(:post).with(answer).and_raise(Twitter::Error::Unauthorized) allow_any_instance_of(Services::Twitter).to receive(:post).with(answer).and_raise(Twitter::Error::Unauthorized)
subject subject
ShareWorker.drain ShareWorker.drain
expect(Sidekiq.logger).to have_received(:info).with("Tried to post answer ##{answer.id} from user ##{user.id} to Twitter but the token has exired or been revoked.") expect(Sidekiq.logger).to have_received(:info).with("Tried to post answer ##{answer.id} from user ##{user.id} to Twitter but the token has expired or been revoked.")
end end
it "revokes the service connection when Twitter::Error::Unauthorized is raised" do it "revokes the service connection when Twitter::Error::Unauthorized is raised" do