Adjust ApplicationHelper tests

This commit is contained in:
Andreas Nedbal 2022-01-16 01:05:10 +01:00 committed by Andreas Nedbal
parent a438e414c9
commit 914b56369b
1 changed files with 18 additions and 18 deletions

View File

@ -15,13 +15,13 @@ describe ApplicationHelper::GraphMethods, :type => :helper do
it 'should generate a matching OpenGraph structure for a user' do it 'should generate a matching OpenGraph structure for a user' do
allow(APP_CONFIG).to receive(:[]).with('site_name').and_return('pineapplespring') allow(APP_CONFIG).to receive(:[]).with('site_name').and_return('pineapplespring')
expect(subject).to eq(<<~EOS.chomp) expect(subject).to eq(<<~EOS.chomp)
<meta property="og:title" content="Cunes" /> <meta property="og:title" content="Cunes">
<meta property="og:type" content="profile" /> <meta property="og:type" content="profile">
<meta property="og:image" content="http://test.host/images/large/no_avatar.png" /> <meta property="og:image" content="http://test.host/images/large/no_avatar.png">
<meta property="og:url" content="http://test.host/raccoons" /> <meta property="og:url" content="http://test.host/raccoons">
<meta property="og:description" content="A bunch of raccoons in a trenchcoat." /> <meta property="og:description" content="A bunch of raccoons in a trenchcoat.">
<meta property="og:site_name" content="pineapplespring" /> <meta property="og:site_name" content="pineapplespring">
<meta property="profile:username" content="raccoons" /> <meta property="profile:username" content="raccoons">
EOS EOS
end end
end end
@ -38,11 +38,11 @@ describe ApplicationHelper::GraphMethods, :type => :helper do
subject { user_twitter_card(user) } subject { user_twitter_card(user) }
it 'should generate a matching OpenGraph structure for a user' do it 'should generate a matching OpenGraph structure for a user' do
expect(subject).to eq(<<~EOS.chomp) expect(subject).to eq(<<~EOS.chomp)
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@retrospring" /> <meta name="twitter:site" content="@retrospring">
<meta name="twitter:title" content="Ask me anything!" /> <meta name="twitter:title" content="Ask me anything!">
<meta name="twitter:description" content="Ask raccoons anything on Retrospring" /> <meta name="twitter:description" content="Ask raccoons anything on Retrospring">
<meta name="twitter:image" content="http://test.host/images/large/no_avatar.png" /> <meta name="twitter:image" content="http://test.host/images/large/no_avatar.png">
EOS EOS
end end
end end
@ -63,12 +63,12 @@ describe ApplicationHelper::GraphMethods, :type => :helper do
it 'should generate a matching OpenGraph structure for a user' do it 'should generate a matching OpenGraph structure for a user' do
allow(APP_CONFIG).to receive(:[]).with('site_name').and_return('pineapplespring') allow(APP_CONFIG).to receive(:[]).with('site_name').and_return('pineapplespring')
expect(subject).to eq(<<~EOS.chomp) expect(subject).to eq(<<~EOS.chomp)
<meta property="og:title" content="raccoons answered: #{answer.question.content}" /> <meta property="og:title" content="raccoons answered: #{answer.question.content}">
<meta property="og:type" content="article" /> <meta property="og:type" content="article">
<meta property="og:image" content="http://test.host/images/large/no_avatar.png" /> <meta property="og:image" content="http://test.host/images/large/no_avatar.png">
<meta property="og:url" content="http://test.host/raccoons/a/#{answer.id}" /> <meta property="og:url" content="http://test.host/raccoons/a/#{answer.id}">
<meta property="og:description" content="#{answer.content}" /> <meta property="og:description" content="#{answer.content}">
<meta property="og:site_name" content="pineapplespring" /> <meta property="og:site_name" content="pineapplespring">
EOS EOS
end end
end end