Commit b734b4f2 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Add payment form URL

parent b59a8cc6
......@@ -9,8 +9,13 @@ module Gitlab
def self.subscriptions_url
ENV.fetch('CUSTOMER_PORTAL_URL', default_subscriptions_url)
end
def self.payment_form_url
"#{self.subscriptions_url}/payment_forms/cc_validation"
end
end
end
Gitlab::SubscriptionPortal.prepend_mod
Gitlab::SubscriptionPortal::SUBSCRIPTIONS_URL = Gitlab::SubscriptionPortal.subscriptions_url.freeze
Gitlab::SubscriptionPortal::PAYMENT_FORM_URL = Gitlab::SubscriptionPortal.payment_form_url.freeze
......@@ -40,5 +40,42 @@ RSpec.describe ::Gitlab::SubscriptionPortal do
end
end
end
describe '.payment_form_url' do
subject { described_class.payment_form_url }
context 'on non test and non dev environments' do
before do
allow(Rails).to receive_message_chain(:env, :test?).and_return(false)
allow(Rails).to receive_message_chain(:env, :development?).and_return(false)
end
it 'returns URL to production payment form' do
is_expected.to eq('https://customers.gitlab.com/payment_forms/cc_validation')
end
end
context 'on dev environment' do
before do
allow(Rails).to receive_message_chain(:env, :test?).and_return(false)
allow(Rails).to receive_message_chain(:env, :development?).and_return(true)
end
it 'returns URL to staging payment form' do
is_expected.to eq('https://customers.stg.gitlab.com/payment_forms/cc_validation')
end
end
context 'on test environment' do
before do
allow(Rails).to receive_message_chain(:env, :test?).and_return(true)
allow(Rails).to receive_message_chain(:env, :development?).and_return(false)
end
it 'returns URL to staging payment form' do
is_expected.to eq('https://customers.stg.gitlab.com/payment_forms/cc_validation')
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment