-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a page which allows assessors to change the email address associated with an application/teacher. To implement this I've refactored the existing change name page to use a different path.
- Loading branch information
1 parent
1b5c888
commit 29c8373
Showing
15 changed files
with
244 additions
and
22 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
26 changes: 26 additions & 0 deletions
26
app/views/assessor_interface/application_forms/edit_email.html.erb
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,26 @@ | ||
<% title = "Change email for ‘#{application_form_full_name(@application_form)}’" %> | ||
|
||
<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %> | ||
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> | ||
|
||
<%= form_with model: @form, url: [:email, :assessor_interface, @application_form] do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<h1 class="govuk-heading-xl"><%= title %></h1> | ||
|
||
<h2 class="govuk-heading-m">Current email</h2> | ||
|
||
<%= govuk_summary_list(actions: false) do |summary_list| | ||
summary_list.with_row do |row| | ||
row.with_key { "Email" } | ||
row.with_value { @application_form.teacher.email } | ||
end | ||
end %> | ||
|
||
<h2 class="govuk-heading-m">Change email</h2> | ||
<p class="govuk-body">Use this form to change the email address.</p> | ||
|
||
<%= f.govuk_text_field :email %> | ||
|
||
<%= render "shared/assessor_interface/continue_cancel_button", f: %> | ||
<% end %> |
4 changes: 2 additions & 2 deletions
4
...interface/application_forms/edit.html.erb → ...face/application_forms/edit_name.html.erb
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
15 changes: 15 additions & 0 deletions
15
spec/support/autoload/page_objects/assessor_interface/edit_application_email.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,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module PageObjects | ||
module AssessorInterface | ||
class EditApplicationEmail < SitePrism::Page | ||
set_url "/assessor/applications/{reference}/email" | ||
|
||
section :form, "form" do | ||
element :email_field, | ||
"#assessor-interface-application-form-email-form-email-field" | ||
element :submit_button, ".govuk-button" | ||
end | ||
end | ||
end | ||
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
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
66 changes: 66 additions & 0 deletions
66
spec/system/assessor_interface/change_application_form_email_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,66 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Assessor change application form email", type: :system do | ||
before { given_there_is_an_application_form } | ||
|
||
it "checks manage applications permission" do | ||
given_i_am_authorized_as_a_user(assessor) | ||
|
||
when_i_visit_the(:assessor_edit_application_email_page, reference:) | ||
then_i_see_the_forbidden_page | ||
end | ||
|
||
it "allows changing application form name" do | ||
given_i_am_authorized_as_a_user(manager) | ||
|
||
when_i_visit_the(:assessor_application_page, reference:) | ||
then_i_see_the(:assessor_application_page) | ||
|
||
when_i_click_on_change_email | ||
then_i_see_the(:assessor_edit_application_email_page, reference:) | ||
|
||
when_i_fill_in_the_email | ||
then_i_see_the(:assessor_application_page, reference:) | ||
end | ||
|
||
def given_there_is_an_application_form | ||
application_form | ||
end | ||
|
||
def when_i_click_on_change_email | ||
assessor_application_page | ||
.summary_list | ||
.find_row(key: "Email") | ||
.actions | ||
.link | ||
.click | ||
end | ||
|
||
def when_i_fill_in_the_email | ||
assessor_edit_application_email_page.form.email_field.fill_in with: | ||
"[email protected]" | ||
assessor_edit_application_email_page.form.submit_button.click | ||
end | ||
|
||
def application_form | ||
@application_form ||= | ||
create( | ||
:application_form, | ||
:submitted, | ||
:with_personal_information, | ||
:with_assessment, | ||
) | ||
end | ||
|
||
delegate :reference, to: :application_form | ||
|
||
def assessor | ||
create(:staff, :confirmed, :with_assess_permission) | ||
end | ||
|
||
def manager | ||
create(:staff, :confirmed, :with_change_email_permission) | ||
end | ||
end |
Oops, something went wrong.