Skip to content

Commit

Permalink
Merge pull request #18 from cs169/sad-path-tests
Browse files Browse the repository at this point in the history
added test for when stripe charge fails (recurring_donation record should not be created)
  • Loading branch information
winsonwan authored Apr 28, 2024
2 parents e630f6e + 4c4d50d commit aef99ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions features/donations/monthly_donation_user_view.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ 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"
And I press "Charge Donation to Credit Card"

@stubs_successful_credit_card_payment
Scenario: make donation
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
Then there should not be a Recurring Donation model instance belonging to "Tom Foolery"
3 changes: 3 additions & 0 deletions features/step_definitions/option_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit aef99ae

Please sign in to comment.