-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw together temporary version of unsubscribe page
- Loading branch information
Showing
2 changed files
with
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<% content_for :page_title, "Unsubscribed" %> | ||
|
||
<%# TODO: This page needs an actual proper design %> | ||
<%# TODO: What shall we do if the user is actually logged in when they're on this page? %> | ||
<%= render Tailwind::Heading.new(tag: :h1).with_content("You have been unsubscribed") %> | ||
|
||
<% if @alert %> | ||
<p class="mt-8 text-2xl text-navy"> | ||
You will no longer receive email alerts for any planning applications we find near | ||
<%= @alert.address %> | ||
(within <%= meters_in_words(@alert.radius_meters.to_f) %>). | ||
</p> | ||
<p class="mt-8 text-2xl text-navy"> | ||
If this was a mistake | ||
<%# TODO: The url below will get redirected. Send to correct path %> | ||
<%= pa_link_to "you could always create a new alert for the same address", new_alert_path(address: @alert.address) %> | ||
</p> | ||
<% else %> | ||
<p class="mt-8 text-2xl text-navy"> | ||
If this was a mistake | ||
<%# TODO: The url below will get redirected. Send to correct path %> | ||
<%= pa_link_to "you could always create a new alert", new_alert_path %> | ||
</p> | ||
<% end %> |
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 |
---|---|---|
|
@@ -19,6 +19,44 @@ | |
user: User.find_by(email: "[email protected]"))).to be_nil | ||
end | ||
|
||
describe "Unsubscribe from an email alert in the new design" do | ||
let(:user) { create(:confirmed_user, tailwind_theme: true, name: "Jane Ng") } | ||
let(:alert) do | ||
# Adding arbitrary coordinates so that geocoding is not carried out | ||
create(:alert, | ||
address: "24 Bruce Rd, Glenbrook", | ||
user: create(:user, email: "[email protected]"), | ||
radius_meters: Alert::DEFAULT_RADIUS, lat: 1.0, lng: 1.0) | ||
end | ||
|
||
before do | ||
sign_in user | ||
visit unsubscribe_alert_path(confirm_id: alert.confirm_id) | ||
end | ||
|
||
# rubocop:disable RSpec/NoExpectationExample | ||
it "renders a snapshot for a visual diff", js: true do | ||
page.percy_snapshot("Alert unsubscribe") | ||
end | ||
# rubocop:enable RSpec/NoExpectationExample | ||
end | ||
|
||
describe "Unsubscribe from a non-existent email alert in the new design" do | ||
let(:user) { create(:confirmed_user, tailwind_theme: true, name: "Jane Ng") } | ||
|
||
before do | ||
sign_in user | ||
# This is an invalid confirm_id | ||
visit unsubscribe_alert_path(confirm_id: "abcd") | ||
end | ||
|
||
# rubocop:disable RSpec/NoExpectationExample | ||
it "renders a snapshot for a visual diff", js: true do | ||
page.percy_snapshot("Alert unsubscribe invalid") | ||
end | ||
# rubocop:enable RSpec/NoExpectationExample | ||
end | ||
|
||
it "Change size of email alert" do | ||
user = create(:confirmed_user, email: "[email protected]") | ||
alert = create(:alert, | ||
|