Set member status to sustainer upon payment
Introduces a state machine for the payment status as well. refs #213
This commit is contained in:
@@ -177,7 +177,7 @@ RSpec.describe "Donations", type: :request do
|
||||
.to_return(status: 200, headers: {}, body: invoice)
|
||||
stub_request(:get, "http://btcpay.example.com/api/v1/stores/123456/invoices/MCkDbf2cUgBuuisUCgnRnb/payment-methods")
|
||||
.to_return(status: 200, headers: {}, body: payments)
|
||||
|
||||
allow(user).to receive(:add_member_status).with(:sustainer).and_return(["sustainer"])
|
||||
get confirm_btcpay_contributions_donation_path(subject)
|
||||
end
|
||||
|
||||
@@ -185,11 +185,16 @@ RSpec.describe "Donations", type: :request do
|
||||
subject.reload
|
||||
expect(subject.paid_at).not_to be_nil
|
||||
expect(subject.amount_sats).to eq(2061)
|
||||
expect(subject.payment_status).to eq("settled")
|
||||
end
|
||||
|
||||
it "redirects to the donations index" do
|
||||
expect(response).to redirect_to(contributions_donations_url)
|
||||
end
|
||||
|
||||
it "updates the user's member status" do
|
||||
expect(user).to have_received(:add_member_status).with(:sustainer)
|
||||
end
|
||||
end
|
||||
|
||||
describe "amount in sats" do
|
||||
|
||||
Reference in New Issue
Block a user