mirror of
https://github.com/we-promise/sure.git
synced 2026-04-25 23:14:10 +00:00
Move payment link lookup into Stripe provider
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/a5dee415-c4db-4b62-b0f3-deacb6c650ce Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
88b130e5bd
commit
d36103dc6c
@@ -15,10 +15,8 @@ class Settings::PaymentsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "shows payment settings when family has stripe_customer_id" do
|
||||
@family.update!(stripe_customer_id: "cus_test123")
|
||||
Settings::PaymentsController.any_instance.stubs(:payment_link_id).returns("plink_test123")
|
||||
stripe = mock
|
||||
stripe.expects(:payment_link_url)
|
||||
.with(payment_link_id: "plink_test123")
|
||||
stripe.expects(:one_time_contribution_url)
|
||||
.returns("https://buy.stripe.com/test_payment_link")
|
||||
Provider::Registry.stubs(:get_provider).with(:stripe).returns(stripe)
|
||||
|
||||
@@ -33,10 +31,8 @@ class Settings::PaymentsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "shows payment settings without contribution link when payment link is unavailable" do
|
||||
@family.update!(stripe_customer_id: "cus_test123")
|
||||
Settings::PaymentsController.any_instance.stubs(:payment_link_id).returns("plink_test123")
|
||||
stripe = mock
|
||||
stripe.expects(:payment_link_url)
|
||||
.with(payment_link_id: "plink_test123")
|
||||
stripe.expects(:one_time_contribution_url)
|
||||
.returns(nil)
|
||||
Provider::Registry.stubs(:get_provider).with(:stripe).returns(stripe)
|
||||
|
||||
@@ -50,18 +46,4 @@ class Settings::PaymentsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select "p", text: I18n.t("views.settings.payments.show.payment_via_stripe")
|
||||
end
|
||||
|
||||
test "shows payment settings without contribution link when payment link id is missing" do
|
||||
@family.update!(stripe_customer_id: "cus_test123")
|
||||
Settings::PaymentsController.any_instance.stubs(:payment_link_id).returns(nil)
|
||||
Provider::Registry.expects(:get_provider).with(:stripe).never
|
||||
|
||||
get settings_payment_path
|
||||
assert_response :success
|
||||
assert_select(
|
||||
"a",
|
||||
text: I18n.t("views.settings.payments.show.one_time_contribution_link_text"),
|
||||
count: 0
|
||||
)
|
||||
assert_select "p", text: I18n.t("views.settings.payments.show.payment_via_stripe")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user