Add test for handling answers that don't need to be shortened for tweets

This commit is contained in:
Karina Kwiatek 2021-12-25 22:27:32 +01:00
parent 3204aaa2e9
commit 570425821f
1 changed files with 11 additions and 0 deletions

View File

@ -31,5 +31,16 @@ describe Services::Twitter do
expect(twitter_client).to have_received(:update!).with("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}") expect(twitter_client).to have_received(:update!).with("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}")
end end
it "posts an un-shortened tweet" do
answer.question.content = 'Why are raccoons so good?'
answer.question.save!
answer.content = 'Because they are good cunes.'
answer.save!
service.post(answer)
expect(twitter_client).to have_received(:update!).with("#{answer.question.content}#{answer.content} https://example.com/#{user.screen_name}/a/#{answer.id}")
end
end end
end end