require 'spec_helper' require 'haml' describe 'pugin/components/_status.html.haml', type: :view do context 'while not in a dissolution' do before :each do allow(Pugin::Feature::Bandiera).to receive(:dissolution?).and_return(false) allow(Pugin::Feature::Bandiera).to receive(:register_to_vote?).and_return(false) allow(Pugin::Feature::Bandiera).to receive(:election?).and_return(false) end it 'renders a message not related to the dissolution' do render partial: 'pugin/components/status', locals: { status: nil } expect(response).to eq( <

This is a test website, so may be inaccurate. Give feedback to help improve it.

DATA ) end end context 'while in a dissolution and still able to register to vote' do before :each do allow(Pugin::Feature::Bandiera).to receive(:dissolution?).and_return(true) 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( <

This is a test website, so may be inaccurate. Give feedback to help improve it. Register to vote in the general election by 22 May.

DATA ) end end context 'while in a dissolution and registration has closed' do before :each do allow(Pugin::Feature::Bandiera).to receive(:dissolution?).and_return(true) allow(Pugin::Feature::Bandiera).to receive(:register_to_vote?).and_return(false) 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( <

This is a test website, so may be inaccurate. Give feedback to help improve it. Find out how to vote in the general election on 8 June.

DATA ) end end context 'while on election day' do before :each do allow(Pugin::Feature::Bandiera).to receive(:dissolution?).and_return(false) allow(Pugin::Feature::Bandiera).to receive(:register_to_vote?).and_return(false) allow(Pugin::Feature::Bandiera).to receive(:election?).and_return(true) 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( <

This is a test website, so may be inaccurate. Give feedback to help improve it. Thursday 8 June is election day, find out how to vote.

DATA ) end end end