spec/views/pugin/components/_status.html.haml_spec.rb in pugin-1.6.1 vs spec/views/pugin/components/_status.html.haml_spec.rb in pugin-1.6.3
- old
+ new
@@ -12,25 +12,13 @@
end
it 'renders a message not related to the dissolution' do
render partial: 'pugin/components/status', locals: { status: nil }
- expect(response).to eq(
-<<DATA
-<div class='status--banner'>
-<div class='container'>
-<p>
-<img alt='' aria-hidden='true' aria-label='caution' class='icon--inline' src='https://s3-eu-west-1.amazonaws.com/web1live.pugin-website/1.6.4/icons/caution-circle-white.svg'>
-<span class='sr-only'>caution</span>
-This is a test website, so may be inaccurate.
-<a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
-to help improve it.
-</p>
-</div>
-</div>
-DATA
- )
+ expect(rendered).not_to include(I18n.t('pugin.components.status.election_text_1'))
+ expect(rendered).not_to include(I18n.t('pugin.components.status.election_text_3'))
+ expect(rendered).not_to include(I18n.t('pugin.components.status.how_to_vote'))
end
end
context 'while in a dissolution and still able to register to vote' do
@@ -39,27 +27,12 @@
allow(Pugin::Feature::Bandiera).to receive(:register_to_vote?).and_return(true)
end
it 'renders a message that shows a link to register to vote' do
render partial: 'pugin/components/status', locals: { status: nil }
- expect(response).to eq(
-<<DATA
-<div class='status--banner'>
-<div class='container'>
-<p>
-<img alt='' aria-hidden='true' aria-label='caution' class='icon--inline' src='https://s3-eu-west-1.amazonaws.com/web1live.pugin-website/1.6.4/icons/caution-circle-white.svg'>
-<span class='sr-only'>caution</span>
-This is a test website, so may be inaccurate.
-<a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
-to help improve it.
-<a href='https://www.gov.uk/register-to-vote'>Register to vote</a>
-in the general election by 22 May.
-</p>
-</div>
-</div>
-DATA
- )
+
+ expect(rendered).to include("<a href='https://www.gov.uk/register-to-vote'>Register to vote</a>")
end
end
context 'while in a dissolution and registration has closed' do
@@ -69,28 +42,11 @@
end
it 'renders a message that reminds the user of the general election date' do
render partial: 'pugin/components/status', locals: { status: nil }
- expect(response).to eq(
-<<DATA
-<div class='status--banner'>
-<div class='container'>
-<p>
-<img alt='' aria-hidden='true' aria-label='caution' class='icon--inline' src='https://s3-eu-west-1.amazonaws.com/web1live.pugin-website/1.6.4/icons/caution-circle-white.svg'>
-<span class='sr-only'>caution</span>
-This is a test website, so may be inaccurate.
-<a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
-to help improve it.
-Find out
-<a href='http://www.parliament.uk/get-involved/elections/voting/'>how to vote</a>
-in the general election on 8 June.
-</p>
-</div>
-</div>
-DATA
- )
+ expect(rendered).to include(I18n.t('pugin.components.status.election_text_2'))
end
end
context 'while on election day' do
@@ -101,26 +57,10 @@
end
it 'renders a message that reminds the user of the general election date' do
render partial: 'pugin/components/status', locals: { status: nil }
- expect(response).to eq(
-<<DATA
-<div class='status--banner'>
-<div class='container'>
-<p>
-<img alt='' aria-hidden='true' aria-label='caution' class='icon--inline' src='https://s3-eu-west-1.amazonaws.com/web1live.pugin-website/1.6.4/icons/caution-circle-white.svg'>
-<span class='sr-only'>caution</span>
-This is a test website, so may be inaccurate.
-<a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
-to help improve it.
-Thursday 8 June is election day, find out
-<a href='http://www.parliament.uk/get-involved/elections/voting/'>how to vote</a>.
-</p>
-</div>
-</div>
-DATA
- )
+ expect(rendered).to include(I18n.t('pugin.components.status.election_day_text'))
end
end
end