forked from swapmyvote/swapmyvote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swapmyvote#971 from aspiers/reminder-emails
- Loading branch information
Showing
9 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
%p | ||
Hi #{@user.name}, | ||
|
||
%p | ||
Action needed! You haven't yet accepted the offer from | ||
|
||
= @incoming_offer_user.redacted_name | ||
|
||
to vote for your preferred party #{@user.preferred_party.name} in | ||
#{@incoming_offer_user.constituency.name}. | ||
|
||
%p | ||
Please don't keep them waiting! Either | ||
|
||
= succeed "," do | ||
= link_to "accept their offer", root_url | ||
|
||
or | ||
|
||
= succeed "," do | ||
= link_to "decline it", root_url | ||
|
||
so that you can receive other offers and they can look for another | ||
swap elsewhere. | ||
|
||
%p | ||
If you accept, you agree to vote for their preferred party | ||
#{@user.willing_party.name} in your constituency of | ||
(#{@user.constituency.name}). | ||
|
||
%p | ||
All the best, | ||
%br | ||
Swap My Vote Team | ||
%p | ||
<a href="https://www.swapmyvote.uk/?utm_source=email&utm_medium=reminder_to_vote&utm_campaign=site">Swap My Vote</a> | ||
%br | ||
= render partial: "footer_fixed_links" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
spec/views/user_mailer/__snapshots__/reminder_to_accept_swap_by_election.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<p> | ||
Hi John (test user), | ||
</p> | ||
<p> | ||
Action needed! You haven't yet accepted the offer from | ||
Jane (test user) | ||
to vote for your preferred party PartyA in | ||
Constituency2. | ||
</p> | ||
<p> | ||
Please don't keep them waiting! Either | ||
<a href="http://test.host/">accept their offer</a>, | ||
or | ||
<a href="http://test.host/">decline it</a>, | ||
so that you can receive other offers and they can look for another | ||
swap elsewhere. | ||
</p> | ||
<p> | ||
If you accept, you agree to vote for their preferred party | ||
PartyB in your constituency of | ||
(Constituency1). | ||
</p> | ||
<p> | ||
All the best, | ||
<br> | ||
Swap My Vote Team | ||
</p> | ||
<p> | ||
<a href="https://www.swapmyvote.uk/?utm_source=email&utm_medium=reminder_to_vote&utm_campaign=site">Swap My Vote</a> | ||
<br> | ||
<a href="https://twitter.com/intent/follow?screen_name=swapmyvote">Follow us on Twitter</a> | ||
<br> | ||
<a href="https://facebook.com/swapmyvote">Like us on Facebook</a> | ||
|
||
</p> |
35 changes: 35 additions & 0 deletions
35
spec/views/user_mailer/__snapshots__/reminder_to_accept_swap_general.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<p> | ||
Hi John (test user), | ||
</p> | ||
<p> | ||
Action needed! You haven't yet accepted the offer from | ||
Jane (test user) | ||
to vote for your preferred party PartyA in | ||
Constituency2. | ||
</p> | ||
<p> | ||
Please don't keep them waiting! Either | ||
<a href="http://test.host/">accept their offer</a>, | ||
or | ||
<a href="http://test.host/">decline it</a>, | ||
so that you can receive other offers and they can look for another | ||
swap elsewhere. | ||
</p> | ||
<p> | ||
If you accept, you agree to vote for their preferred party | ||
PartyB in your constituency of | ||
(Constituency1). | ||
</p> | ||
<p> | ||
All the best, | ||
<br> | ||
Swap My Vote Team | ||
</p> | ||
<p> | ||
<a href="https://www.swapmyvote.uk/?utm_source=email&utm_medium=reminder_to_vote&utm_campaign=site">Swap My Vote</a> | ||
<br> | ||
<a href="https://twitter.com/intent/follow?screen_name=swapmyvote">Follow us on Twitter</a> | ||
<br> | ||
<a href="https://facebook.com/swapmyvote">Like us on Facebook</a> | ||
|
||
</p> |
35 changes: 35 additions & 0 deletions
35
spec/views/user_mailer/reminder_to_accept_swap.html.haml_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "user_mailer/reminder_to_accept_swap", type: :view do | ||
before do | ||
allow(OnsConstituency).to receive(:all).and_return([build(:wakefield), build(:tiverton)]) | ||
end | ||
|
||
context "in a by-election" do | ||
specify "matches snapshot" do | ||
allow(view).to receive(:general_election?).and_return(false) | ||
swap = build(:swap_with_two_users, confirmed: false) | ||
|
||
assign(:user, swap.choosing_user) | ||
assign(:incoming_offer_user, swap.chosen_user) | ||
|
||
expect { render }.not_to raise_error | ||
|
||
expect(rendered).to match_snapshot("reminder_to_accept_swap_by_election") | ||
end | ||
end | ||
|
||
context "in a general election" do | ||
specify "matches snapshot" do | ||
allow(view).to receive(:general_election?).and_return(true) | ||
swap = build(:swap_with_two_users, confirmed: false) | ||
|
||
assign(:user, swap.choosing_user) | ||
assign(:incoming_offer_user, swap.chosen_user) | ||
|
||
expect { render }.not_to raise_error | ||
|
||
expect(rendered).to match_snapshot("reminder_to_accept_swap_general") | ||
end | ||
end | ||
end |