summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/subscription_portal_spec.rb
blob: ad1affdac0b267199ad6358515fe4cc5dfd8487e (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::Gitlab::SubscriptionPortal do
  unless Gitlab.jh?
    describe '.default_subscriptions_url' do
      subject { described_class.default_subscriptions_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 production subscriptions app URL' do
          is_expected.to eq('https://customers.gitlab.com')
        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 staging subscriptions app url' do
          is_expected.to eq('https://customers.stg.gitlab.com')
        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 staging subscriptions app url' do
          is_expected.to eq('https://customers.stg.gitlab.com')
        end
      end
    end
  end
end