From 758f7628bde9db719795911fe2a7a8df85bc525e Mon Sep 17 00:00:00 2001 From: ac-dylan Date: Wed, 24 Jul 2024 11:13:11 +0200 Subject: [PATCH] abort --- spec/requests/schoolings_controller_spec.rb | 35 +++------------------ 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/spec/requests/schoolings_controller_spec.rb b/spec/requests/schoolings_controller_spec.rb index 1dadde52c..fdf28b4d0 100644 --- a/spec/requests/schoolings_controller_spec.rb +++ b/spec/requests/schoolings_controller_spec.rb @@ -7,8 +7,7 @@ let(:user) { create(:user, :director, :with_selected_establishment, establishment: student.classe.establishment) } let(:schooling) { create(:schooling, :with_attributive_decision) } - let(:payment_request_missing_da) { create(:asp_payment_request, :incomplete_for_missing_abrogation_da) } - let(:payment_request) { create(:asp_payment_request, :incomplete) } + let(:payment_request) { create(:asp_payment_request, :incomplete_for_missing_abrogation_da) } # rubocop:disable Layout/LineLength error_message = I18n.t("activerecord.errors.models.asp/payment_request.attributes.ready_state_validation.needs_abrogated_attributive_decision") @@ -16,7 +15,7 @@ before do sign_in(user) - schooling.pfmps = [payment_request_missing_da.pfmp] + schooling.pfmps = [payment_request.pfmp] schooling.save! Timecop.safe_mode = false Timecop.freeze(Date.new(2024, 6, 21)) @@ -42,37 +41,11 @@ end context "when the payment request is retry eligible" do - it "Does not return abrogated decision error" do + it "does not return abrogated decision error" do delete abrogate_decision_school_year_class_schooling_path(schooling.classe.school_year, class_id: schooling.classe.id, id: schooling.id), params: { confirmed_director: "1" } - expect(payment_request_missing_da.last_transition.metadata).not_to include(error_message) - end - end - - context "when the payment request is retry eligible" do - it "Does not return abrogated decision error" do - schooling.pfmps = [payment_request.pfmp] - schooling.save! - delete abrogate_decision_school_year_class_schooling_path(schooling.classe.school_year, - class_id: schooling.classe.id, id: schooling.id), - params: { confirmed_director: "1" } - expect(payment_request.last_transition.metadata).to include(error_message) - end - end - - context "when the payment request is not retry eligible" do - let(:pfmp) { create(:pfmp, :completed) } - - before do - schooling.update!(pfmps: [pfmp]) - end - - it "Returns abrogated decision error" do - delete abrogate_decision_school_year_class_schooling_path(schooling.classe.school_year, - class_id: schooling.classe.id, id: schooling.id), - params: { confirmed_director: "1" } - expect(payment_request_missing_da.current_state).not_to eq(:ready) + expect(payment_request.last_transition.metadata).not_to include(error_message) end end end