Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ac-dylan committed Jul 19, 2024
1 parent 6f84815 commit e5106d7
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions spec/requests/schoolings_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,30 @@
schooling.update!(end_date: Date.parse("2024-06-20"))
end

it "retries eligible payment requests" 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.last_transition.metadata).not_to include(I18n.t("activerecord.errors.models.asp/payment_request.attributes.ready_state_validation.needs_abrogated_attributive_decision"))
context "when the payment request is retry eligible" do
it "Do 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.last_transition.metadata).not_to include(
I18n.t("activerecord.errors.models.asp/payment_request.attributes.ready_state_validation.needs_abrogated_attributive_decision")
)
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 "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.current_state).not_to eq(:ready)
end
end
end
end

0 comments on commit e5106d7

Please sign in to comment.