Skip to content

Commit

Permalink
Rename professional standing request location
Browse files Browse the repository at this point in the history
I've renamed it to locate to match the action style we've gone with for
review, verify and request.
  • Loading branch information
thomasleese committed Oct 9, 2023
1 parent 6a00bf5 commit 7df876a
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module AssessorInterface
class ProfessionalStandingRequestsController < BaseController
before_action :set_variables

def edit_location
authorize [:assessor_interface, professional_standing_request], :show?
def edit_locate
authorize [:assessor_interface, professional_standing_request]

@form =
ProfessionalStandingRequestLocationForm.new(
Expand All @@ -17,8 +17,8 @@ def edit_location
)
end

def update_location
authorize [:assessor_interface, professional_standing_request], :show?
def update_locate
authorize [:assessor_interface, professional_standing_request]

@form =
ProfessionalStandingRequestLocationForm.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ def show?
true
end

def update_locate?
true
end

alias_method :edit_locate?, :update_locate?

def update_request?
user.verify_permission
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def await_professional_standing_task_list_item
"assessor_interface.application_forms.show.assessment_tasks.items.await_professional_standing_request",
),
link: [
:location,
:locate,
:assessor_interface,
application_form,
assessment,
Expand Down Expand Up @@ -328,7 +328,7 @@ def locate_professional_standing_request_task_list_item
"assessor_interface.application_forms.show.assessment_tasks.items.locate_professional_standing_request",
),
link: [
:location,
:locate,
:assessor_interface,
application_form,
assessment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% content_for :page_title, "#{"Error: " if @form.errors.any?}#{title}" %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:location, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= form_with model: @form, url: [:locate, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-xl"><%= title %></h1>
Expand Down
5 changes: 2 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@
path: "/professional-standing-request",
only: [] do
member do
get "location", to: "professional_standing_requests#edit_location"
post "location",
to: "professional_standing_requests#update_location"
get "locate", to: "professional_standing_requests#edit_locate"
post "locate", to: "professional_standing_requests#update_locate"
get "review", to: "professional_standing_requests#edit_review"
post "review", to: "professional_standing_requests#update_review"
get "verify", to: "professional_standing_requests#edit_verify"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@
it { is_expected.to be false }
end

describe "#update_locate?" do
subject(:update_locate?) { policy.update_locate? }

let(:user) { create(:staff, :confirmed) }
it { is_expected.to be true }
end

describe "#edit_locate?" do
subject(:edit?) { policy.edit_locate? }

let(:user) { create(:staff, :confirmed) }
it { is_expected.to be true }
end

describe "#update_request?" do
subject(:update_request?) { policy.update_request? }
it_behaves_like "a policy method requiring the verify permission"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module PageObjects
module AssessorInterface
class Application < SitePrism::Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module PageObjects
module AssessorInterface
class EditProfessionalStandingRequestLocation < SitePrism::Page
set_url "/assessor/applications/{application_id}/assessments/{assessment_id}" \
"/professional-standing-request/location"
class LocateProfessionalStandingRequest < SitePrism::Page
set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \
"/professional-standing-request/locate"

section :form, "form" do
element :received_checkbox, ".govuk-checkboxes__input", visible: false
Expand Down
10 changes: 5 additions & 5 deletions spec/support/page_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ def assessor_edit_application_page
PageObjects::AssessorInterface::EditApplication.new
end

def assessor_edit_professional_standing_request_location_page
@assessor_edit_professional_standing_request_location_page ||=
PageObjects::AssessorInterface::EditProfessionalStandingRequestLocation.new
end

def assessor_edit_qualification_request_page
@assessor_edit_qualification_request_page ||=
PageObjects::AssessorInterface::EditQualificationRequest.new
Expand All @@ -57,6 +52,11 @@ def assessor_edit_work_history_page
PageObjects::AssessorInterface::EditWorkHistory.new
end

def assessor_locate_professional_standing_request_page
@assessor_locate_professional_standing_request_page ||=
PageObjects::AssessorInterface::LocateProfessionalStandingRequest.new
end

def assessor_qualification_requests_page
@assessor_qualification_requests_page ||=
PageObjects::AssessorInterface::QualificationRequests.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
and_i_see_a_waiting_on_status
and_i_click_awaiting_professional_standing
then_i_see_the(
:assessor_edit_professional_standing_request_location_page,
application_id:,
:assessor_locate_professional_standing_request_page,
application_form_id:,
)

when_i_fill_in_the_form
Expand All @@ -41,7 +41,7 @@ def and_i_click_awaiting_professional_standing
end

def when_i_fill_in_the_form
form = assessor_edit_professional_standing_request_location_page.form
form = assessor_locate_professional_standing_request_page.form

form.received_checkbox.click
form.note_textarea.fill_in with: "Note."
Expand Down Expand Up @@ -77,7 +77,9 @@ def application_form
)
end

def application_id
def application_form_id
application_form.id
end

alias_method :application_id, :application_form_id
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
and_i_see_a_waiting_on_status
and_i_click_record_professional_standing_task
then_i_see_the(
:assessor_edit_professional_standing_request_location_page,
application_id:,
:assessor_locate_professional_standing_request_page,
application_form_id:,
)

when_i_fill_in_the_location_form
Expand Down Expand Up @@ -45,10 +45,7 @@ def and_i_see_a_waiting_on_status
end

def and_i_click_record_professional_standing_task
assessor_application_page
.record_professional_standing_request_task
.link
.click
assessor_application_page.record_professional_standing_request_task.click
end

def when_i_click_review_professional_standing_task
Expand All @@ -59,7 +56,7 @@ def when_i_click_review_professional_standing_task
end

def when_i_fill_in_the_location_form
form = assessor_edit_professional_standing_request_location_page.form
form = assessor_locate_professional_standing_request_page.form

form.received_yes_radio_item.choose
form.note_textarea.fill_in with: "Note."
Expand Down

0 comments on commit 7df876a

Please sign in to comment.