Fix `SocialHelper::TwitterMethods` tests so they work anywhere
This commit is contained in:
parent
8dd14e4a05
commit
b544145b93
|
@ -8,12 +8,20 @@ describe SocialHelper::TwitterMethods, :type => :helper do
|
|||
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
|
||||
|
||||
|
@ -28,7 +36,7 @@ describe SocialHelper::TwitterMethods, :type => :helper do
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue