Skip to content

Commit

Permalink
Fix SocialHelper::TwitterMethods tests so they work anywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeldesu committed Dec 27, 2021
1 parent 8c31875 commit 3248da0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/helpers/social_helper/twitter_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
content: 'a' * 255,
question_content: 'q' * 255) }

before do
stub_const("APP_CONFIG", {
'hostname' => 'example.com',
'https' => true,
'items_per_page' => 5
})
end

describe '#prepare_tweet' do
context 'when the question and answer need to be shortened' do
subject { prepare_tweet(answer) }

it 'should return a properly formatted tweet' do
expect(subject).to eq("#{'q' * 123}… — #{'a' * 124}… https://justask.rrerr.net/#{user.screen_name}/a/#{answer.id}")
expect(subject).to eq("#{'q' * 123}… — #{'a' * 124}… https://example.com/#{user.screen_name}/a/#{answer.id}")
end
end

Expand All @@ -28,7 +36,7 @@
subject { prepare_tweet(answer) }

it 'should return a properly formatted tweet' do
expect(subject).to eq("#{answer.question.content}#{answer.content} https://justask.rrerr.net/#{user.screen_name}/a/#{answer.id}")
expect(subject).to eq("#{answer.question.content}#{answer.content} https://example.com/#{user.screen_name}/a/#{answer.id}")
end
end
end
Expand Down

0 comments on commit 3248da0

Please sign in to comment.