From 5f3cb1696f5821cde90d9563b2d6dc81097676d2 Mon Sep 17 00:00:00 2001 From: rnickles Date: Fri, 26 Apr 2024 18:17:09 -0700 Subject: [PATCH 1/2] added test --- .../donations/monthly_donation_user_view.feature | 12 ++++++++---- features/step_definitions/option_steps.rb | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/features/donations/monthly_donation_user_view.feature b/features/donations/monthly_donation_user_view.feature index ddcef92f..25a5e0bf 100644 --- a/features/donations/monthly_donation_user_view.feature +++ b/features/donations/monthly_donation_user_view.feature @@ -4,13 +4,17 @@ Background: Given I am logged in as customer "Tom Foolery" Given admin "has" allowed recurring donations And I go to the quick donation page - -@stubs_successful_credit_card_payment -Scenario: make donation Then I should see "frequency" When I select monthly in the donation frequency radio button When I fill in "Donation amount" with "15" + +@stubs_successful_credit_card_payment +Scenario: make donation And I press "Charge Donation to Credit Card" Then I should see "You have paid a total of $15.00 by Credit card" Then there should be a Recurring Donation model instance belonging to "Tom Foolery" - \ No newline at end of file + +@stubs_failed_credit_card_payment +Scenario: attempt to make a donation but card payment fails + And I press "Charge Donation to Credit Card" + Then there should not be a Recurring Donation model instance belonging to "Tom Foolery" \ No newline at end of file diff --git a/features/step_definitions/option_steps.rb b/features/step_definitions/option_steps.rb index 2839a7a2..07643aaa 100644 --- a/features/step_definitions/option_steps.rb +++ b/features/step_definitions/option_steps.rb @@ -72,3 +72,6 @@ expect(c.first_name).to eq(first) expect(c.last_name).to eq(last) end + Then /there should not be a Recurring Donation model instance belonging to "(.*) (.*)"$/ do |first,last| + expect(RecurringDonation.first).to eq(nil) + end From 4c4d50ddda12ecefa0a4b7aadfceaf19d4c325d0 Mon Sep 17 00:00:00 2001 From: rnickles Date: Sat, 27 Apr 2024 00:24:31 -0700 Subject: [PATCH 2/2] made DRY-er --- features/donations/monthly_donation_user_view.feature | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/features/donations/monthly_donation_user_view.feature b/features/donations/monthly_donation_user_view.feature index 25a5e0bf..a60528cb 100644 --- a/features/donations/monthly_donation_user_view.feature +++ b/features/donations/monthly_donation_user_view.feature @@ -7,14 +7,13 @@ Background: Then I should see "frequency" When I select monthly in the donation frequency radio button When I fill in "Donation amount" with "15" + And I press "Charge Donation to Credit Card" @stubs_successful_credit_card_payment Scenario: make donation - And I press "Charge Donation to Credit Card" Then I should see "You have paid a total of $15.00 by Credit card" Then there should be a Recurring Donation model instance belonging to "Tom Foolery" @stubs_failed_credit_card_payment Scenario: attempt to make a donation but card payment fails - And I press "Charge Donation to Credit Card" Then there should not be a Recurring Donation model instance belonging to "Tom Foolery" \ No newline at end of file