Skip to content

Commit

Permalink
AP-4170 delete dwp override on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldstone93 committed Oct 30, 2023
1 parent c9056de commit b616e47
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ConfirmDWPNonPassportedApplicationsController < ProviderBaseController

def show
delete_check_benefits_from_history
remove_dwp_override
@form = Providers::ConfirmDWPNonPassportedApplicationsForm.new(model: partner)
end

Expand All @@ -25,6 +26,10 @@ def update

private

def remove_dwp_override
legal_aid_application.dwp_override&.destroy!
end

def partner
@partner = legal_aid_application.partner
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
expect(unescaped_response_body).not_to include(I18n.t(".providers.confirm_dwp_non_passported_applications.show.option_partner"))
end
end

context "when there is a DWP override before visiting the page" do
it "is successfully deleted" do
login_as application.provider
create(:dwp_override, legal_aid_application: application)
get_request
expect(application.reload.dwp_override).to be_nil
end
end
end

describe "PATCH /providers/applications/:legal_aid_application_id/confirm_dwp_non_passported_applications" do
Expand Down

0 comments on commit b616e47

Please sign in to comment.