From 439a109ac2bd58f23775682a719b5ad74c166389 Mon Sep 17 00:00:00 2001 From: Ken Date: Thu, 16 Jan 2025 10:21:22 +1100 Subject: [PATCH] Add slack link to confirmation email (#270) --- .../mailer/confirmation_instructions.html.erb | 2 ++ .../committee_manages_members_spec.rb | 6 ++-- ...confirmation_instructions.html.erb_spec.rb | 35 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 spec/views/devise/mailer/confirmation_instructions.html.erb_spec.rb diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index e2be0e58..615fc105 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -7,3 +7,5 @@ Confirm your membership with Ruby Australia.

To confirm both your email address and your membership for Ruby Australia, please follow the link below:

<%= link_to 'Confirm my membership', confirmation_url(@resource, confirmation_token: @token) %>

+ +

Once you've completed the confirmation above, be sure to join our Slack community at <%= link_to 'Slack', slack_url %>.

diff --git a/spec/features/committee_manages_members_spec.rb b/spec/features/committee_manages_members_spec.rb index 755d8708..412ff452 100644 --- a/spec/features/committee_manages_members_spec.rb +++ b/spec/features/committee_manages_members_spec.rb @@ -39,13 +39,15 @@ expect(page).to have_content("Alex") expect(page).to have_content("Not yet") + last_year = Time.zone.today.year - 1 + click_link "Edit" - select "2019", from: "access_request_viewed_on_1i" + select last_year.to_s, from: "access_request_viewed_on_1i" select "December", from: "access_request_viewed_on_2i" select "31", from: "access_request_viewed_on_3i" click_button "Save" expect(page).to have_content("Alex") - expect(page).to have_content("2019-12-31") + expect(page).to have_content("#{last_year}-12-31") end end diff --git a/spec/views/devise/mailer/confirmation_instructions.html.erb_spec.rb b/spec/views/devise/mailer/confirmation_instructions.html.erb_spec.rb new file mode 100644 index 00000000..2a646367 --- /dev/null +++ b/spec/views/devise/mailer/confirmation_instructions.html.erb_spec.rb @@ -0,0 +1,35 @@ +require 'rails_helper' + +RSpec.describe "devise/mailer/confirmation_instructions.html.erb", type: :view do + include Rails.application.routes.url_helpers + + let(:user) { create(:user, full_name: "John Doe") } + let(:token) { "fake_token" } + + before do + assign(:resource, user) + assign(:token, token) + + render + end + + it "displays the preheader text" do + expect(rendered).to include("Confirm my membership") + end + + it "displays the welcome message with the user's full name" do + expect(rendered).to match(/Welcome John Doe!/) + end + + it "displays the confirmation instructions" do + expect(rendered).to match(/To confirm both your email address and your membership for Ruby Australia, please follow the link below:/) + end + + it "displays the confirmation link" do + expect(rendered).to have_link('Confirm my membership', href: user_confirmation_url(confirmation_token: token)) + end + + it "displays the Slack community invitation" do + expect(rendered).to have_link('Slack', href: slack_url) + end +end