blob: 768990fae62bc9617c488fb769886d117c2bd282 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Custom URLs', 'Subscription Portal', feature_category: :subscription_management do
using RSpec::Parameterized::TableSyntax
include SubscriptionPortalHelper
let(:env_value) { nil }
let(:staging_env_value) { nil }
before do
stub_env('CUSTOMER_PORTAL_URL', env_value)
stub_env('STAGING_CUSTOMER_PORTAL_URL', staging_env_value)
end
describe 'subscription_portal_staging_url' do
subject { subscription_portal_staging_url }
context 'when STAGING_CUSTOMER_PORTAL_URL is unset' do
it { is_expected.to eq(staging_customers_url) }
end
context 'when STAGING_CUSTOMER_PORTAL_URL is set' do
let(:staging_env_value) { 'https://customers.staging.example.com' }
it { is_expected.to eq(staging_env_value) }
end
end
describe 'subscription_portal_url' do
subject { subscription_portal_url }
context 'when CUSTOMER_PORTAL_URL ENV is unset' do
where(:test, :development, :expected_url) do
false | false | prod_customers_url
false | true | subscription_portal_staging_url
true | false | subscription_portal_staging_url
end
before do
allow(Rails).to receive_message_chain(:env, :test?).and_return(test)
allow(Rails).to receive_message_chain(:env, :development?).and_return(development)
end
with_them do
it { is_expected.to eq(expected_url) }
end
end
context 'when CUSTOMER_PORTAL_URL ENV is set' do
let(:env_value) { 'https://customers.example.com' }
it { is_expected.to eq(env_value) }
end
end
describe 'subscription_portal_instance_review_url' do
subject { subscription_portal_instance_review_url }
it { is_expected.to eq("#{staging_customers_url}/instance_review") }
end
end
|