Skip to content

Commit

Permalink
Ajout de tests unitaires
Browse files Browse the repository at this point in the history
  • Loading branch information
tnicolas1 committed Oct 10, 2024
1 parent c563108 commit e5f7c60
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion spec/models/asp/payment_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@
end
let(:p_r_ready) { create(:asp_payment_request, :ready) }

let(:p_r_rejected) { create(:asp_payment_request, :rejected) }
let(:p_r_rejected_rib) { create(:asp_payment_request, :rejected, reason: "Test d'une raison de blocage d'un paiement bancaire") }
let(:p_r_unpaid) { create(:asp_payment_request, :unpaid) }
let(:p_r_unpaid_rib) { create(:asp_payment_request, :unpaid, reason: "Test d'une raison de blocage d'un paiement bancaire") }

context "when the payment request is in 'incomplete' state with the abrogation specific error message" do
it "returns true" do
expect(p_r_incomplete_for_abrogation.eligible_for_auto_retry?).to be true
Expand All @@ -164,6 +169,28 @@
end
end

# TODO: Ajouter un contexte pour le cas 'rejected' et 'unpaid'
context "when the payment request is in 'rejected' state without a RIB reason" do
it "returns false" do
expect(p_r_rejected.eligible_for_auto_retry?).to be false
end
end

context "when the payment request is in 'rejected' state with a RIB reason" do
it "returns true" do
expect(p_r_rejected_rib.eligible_for_auto_retry?).to be true
end
end

context "when the payment request is in 'unpaid' state without a RIB reason" do
it "returns false" do
expect(p_r_unpaid.eligible_for_auto_retry?).to be false
end
end

context "when the payment request is in 'unpaid' state with a RIB reason" do
it "returns true" do
expect(p_r_unpaid_rib.eligible_for_auto_retry?).to be true
end
end
end
end

0 comments on commit e5f7c60

Please sign in to comment.