Commit 3235302b authored by Thong Kuah's avatar Thong Kuah

Merge branch '349713-remove-dev_env_or_com' into 'master'

Remove Gitlab.dev_env_or_com? in favor of Gitlab.com?

See merge request gitlab-org/gitlab!81319
parents 80774ffb a4887576
...@@ -178,7 +178,7 @@ module AuthHelper ...@@ -178,7 +178,7 @@ module AuthHelper
end end
def google_tag_manager_enabled? def google_tag_manager_enabled?
return false unless Gitlab.dev_env_or_com? return false unless Gitlab.com?
if Feature.enabled?(:gtm_nonce, type: :ops) if Feature.enabled?(:gtm_nonce, type: :ops)
extra_config.has_key?('google_tag_manager_nonce_id') && extra_config.has_key?('google_tag_manager_nonce_id') &&
......
...@@ -5,7 +5,7 @@ module SessionsHelper ...@@ -5,7 +5,7 @@ module SessionsHelper
def recently_confirmed_com? def recently_confirmed_com?
strong_memoize(:recently_confirmed_com) do strong_memoize(:recently_confirmed_com) do
::Gitlab.dev_env_or_com? && ::Gitlab.com? &&
!!flash[:notice]&.include?(t(:confirmed, scope: [:devise, :confirmations])) !!flash[:notice]&.include?(t(:confirmed, scope: [:devise, :confirmations]))
end end
end end
......
...@@ -10,7 +10,7 @@ module WhatsNewHelper ...@@ -10,7 +10,7 @@ module WhatsNewHelper
end end
def display_whats_new? def display_whats_new?
(Gitlab.dev_env_org_or_com? || user_signed_in?) && (Gitlab.org_or_com? || user_signed_in?) &&
!Gitlab::CurrentSettings.current_application_settings.whats_new_variant_disabled? !Gitlab::CurrentSettings.current_application_settings.whats_new_variant_disabled?
end end
......
...@@ -67,7 +67,7 @@ class BasePolicy < DeclarativePolicy::Base ...@@ -67,7 +67,7 @@ class BasePolicy < DeclarativePolicy::Base
rule { default }.enable :read_cross_project rule { default }.enable :read_cross_project
condition(:is_gitlab_com, score: 0, scope: :global) { ::Gitlab.dev_env_or_com? } condition(:is_gitlab_com, score: 0, scope: :global) { ::Gitlab.com? }
end end
BasePolicy.prepend_mod_with('BasePolicy') BasePolicy.prepend_mod_with('BasePolicy')
- return unless Gitlab.dev_env_or_com? - return unless Gitlab.com?
.gl-mb-3.js-email-opt-in.hidden .gl-mb-3.js-email-opt-in.hidden
.gl-font-weight-bold.gl-mb-3 .gl-font-weight-bold.gl-mb-3
......
- return unless Gitlab::CurrentSettings.current_application_settings.enforce_terms? - return unless Gitlab::CurrentSettings.current_application_settings.enforce_terms?
%p.gl-text-gray-500.gl-mt-5.gl-mb-0 %p.gl-text-gray-500.gl-mt-5.gl-mb-0
- if Gitlab.dev_env_or_com? - if Gitlab.com?
= html_escape(s_("SignUp|By clicking %{button_text}, I agree that I have read and accepted the GitLab %{link_start}Terms of Use and Privacy Policy%{link_end}")) % { button_text: button_text, = html_escape(s_("SignUp|By clicking %{button_text}, I agree that I have read and accepted the GitLab %{link_start}Terms of Use and Privacy Policy%{link_end}")) % { button_text: button_text,
link_start: "<a href='#{terms_path}' target='_blank' rel='noreferrer noopener'>".html_safe, link_end: '</a>'.html_safe } link_start: "<a href='#{terms_path}' target='_blank' rel='noreferrer noopener'>".html_safe, link_end: '</a>'.html_safe }
- else - else
......
...@@ -49,7 +49,7 @@ Gitlab::Experiment.configure do |config| ...@@ -49,7 +49,7 @@ Gitlab::Experiment.configure do |config|
# #
valid_domains = %w[about.gitlab.com docs.gitlab.com gitlab.com gdk.test localhost] valid_domains = %w[about.gitlab.com docs.gitlab.com gitlab.com gdk.test localhost]
config.redirect_url_validator = lambda do |url| config.redirect_url_validator = lambda do |url|
Gitlab.dev_env_or_com? && (url = URI.parse(url)) && valid_domains.include?(url.host) Gitlab.com? && (url = URI.parse(url)) && valid_domains.include?(url.host)
rescue URI::InvalidURIError rescue URI::InvalidURIError
false false
end end
......
...@@ -24,7 +24,7 @@ class AddNewTrailPlans < ActiveRecord::Migration[6.0] ...@@ -24,7 +24,7 @@ class AddNewTrailPlans < ActiveRecord::Migration[6.0]
end end
def up def up
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
ultimate_trial = Plan.create!(name: 'ultimate_trial', title: 'Ultimate Trial') ultimate_trial = Plan.create!(name: 'ultimate_trial', title: 'Ultimate Trial')
premium_trial = Plan.create!(name: 'premium_trial', title: 'Premium Trial') premium_trial = Plan.create!(name: 'premium_trial', title: 'Premium Trial')
...@@ -34,7 +34,7 @@ class AddNewTrailPlans < ActiveRecord::Migration[6.0] ...@@ -34,7 +34,7 @@ class AddNewTrailPlans < ActiveRecord::Migration[6.0]
end end
def down def down
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
Plan.where(name: %w(ultimate_trial premium_trial)).delete_all Plan.where(name: %w(ultimate_trial premium_trial)).delete_all
end end
......
...@@ -29,7 +29,7 @@ class UpdateTrialPlansCiDailyPipelineScheduleTriggers < ActiveRecord::Migration[ ...@@ -29,7 +29,7 @@ class UpdateTrialPlansCiDailyPipelineScheduleTriggers < ActiveRecord::Migration[
end end
def up def up
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
if plan_limits_present? if plan_limits_present?
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', PREMIUM_TRIAL, EVERY_5_MINUTES) create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', PREMIUM_TRIAL, EVERY_5_MINUTES)
...@@ -38,7 +38,7 @@ class UpdateTrialPlansCiDailyPipelineScheduleTriggers < ActiveRecord::Migration[ ...@@ -38,7 +38,7 @@ class UpdateTrialPlansCiDailyPipelineScheduleTriggers < ActiveRecord::Migration[
end end
def down def down
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
if plan_limits_present? if plan_limits_present?
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', PREMIUM_TRIAL, 0) create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', PREMIUM_TRIAL, 0)
......
...@@ -24,7 +24,7 @@ class AddOpenSourcePlan < Gitlab::Database::Migration[1.0] ...@@ -24,7 +24,7 @@ class AddOpenSourcePlan < Gitlab::Database::Migration[1.0]
end end
def up def up
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
opensource = Plan.create!(name: 'opensource', title: 'Open Source Program') opensource = Plan.create!(name: 'opensource', title: 'Open Source Program')
...@@ -32,7 +32,7 @@ class AddOpenSourcePlan < Gitlab::Database::Migration[1.0] ...@@ -32,7 +32,7 @@ class AddOpenSourcePlan < Gitlab::Database::Migration[1.0]
end end
def down def down
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
Plan.where(name: 'opensource').delete_all Plan.where(name: 'opensource').delete_all
end end
......
...@@ -256,7 +256,7 @@ module EE ...@@ -256,7 +256,7 @@ module EE
end end
def should_check_namespace_plan? def should_check_namespace_plan?
check_namespace_plan? && (Rails.env.test? || ::Gitlab.dev_env_org_or_com?) check_namespace_plan? && (Rails.env.test? || ::Gitlab.org_or_com?)
end end
def elasticsearch_indexing def elasticsearch_indexing
......
- return unless ::Gitlab.dev_env_org_or_com? - return unless ::Gitlab.org_or_com?
- form = local_assigns.fetch(:form) - form = local_assigns.fetch(:form)
......
...@@ -28,7 +28,7 @@ RSpec.describe TrialsController, :saas do ...@@ -28,7 +28,7 @@ RSpec.describe TrialsController, :saas do
shared_examples 'a dot-com only feature' do shared_examples 'a dot-com only feature' do
let(:success_status) { :ok } let(:success_status) { :ok }
context 'when not on gitlab.com ' do context 'when not on gitlab.com' do
before do before do
allow(::Gitlab).to receive(:com?).and_return(false) allow(::Gitlab).to receive(:com?).and_return(false)
end end
......
...@@ -212,11 +212,11 @@ RSpec.describe ApplicationSetting do ...@@ -212,11 +212,11 @@ RSpec.describe ApplicationSetting do
describe '#should_check_namespace_plan?' do describe '#should_check_namespace_plan?' do
before do before do
stub_application_setting(check_namespace_plan: check_namespace_plan_column) stub_application_setting(check_namespace_plan: check_namespace_plan_column)
allow(::Gitlab).to receive(:dev_env_org_or_com?) { gl_com } allow(::Gitlab).to receive(:org_or_com?) { gl_com }
# This stub was added in order to force a fallback to Gitlab.dev_env_org_or_com? # This stub was added in order to force a fallback to Gitlab.org_or_com?
# call testing. # call testing.
# Gitlab.dev_env_org_or_com? responds to `false` on test envs # Gitlab.org_or_com? responds to `false` on test envs
# and we want to make sure we're still testing # and we want to make sure we're still testing
# should_check_namespace_plan? method through the test-suite (see # should_check_namespace_plan? method through the test-suite (see
# https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/18461#note_69322821). # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/18461#note_69322821).
......
...@@ -368,7 +368,7 @@ RSpec.describe GitlabSubscription, :saas do ...@@ -368,7 +368,7 @@ RSpec.describe GitlabSubscription, :saas do
end end
describe 'callbacks' do describe 'callbacks' do
context 'after_commit :index_namespace' do context 'after_commit :index_namespace', :saas do
let_it_be(:namespace) { create(:namespace) } let_it_be(:namespace) { create(:namespace) }
let(:gitlab_subscription) { build(:gitlab_subscription, plan, namespace: namespace) } let(:gitlab_subscription) { build(:gitlab_subscription, plan, namespace: namespace) }
......
...@@ -88,12 +88,8 @@ module Gitlab ...@@ -88,12 +88,8 @@ module Gitlab
Gitlab::Saas.subdomain_regex === Gitlab.config.gitlab.url Gitlab::Saas.subdomain_regex === Gitlab.config.gitlab.url
end end
def self.dev_env_org_or_com? def self.org_or_com?
dev_env_or_com? || org? org? || com?
end
def self.dev_env_or_com?
com?
end end
def self.dev_or_test_env? def self.dev_or_test_env?
......
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
# no inclusions, etc.) # no inclusions, etc.)
def enabled? def enabled?
return false unless feature_flag_defined? return false unless feature_flag_defined?
return false unless Gitlab.dev_env_or_com? return false unless Gitlab.com?
return false unless ::Feature.enabled?(:gitlab_experiment, type: :ops, default_enabled: :yaml) return false unless ::Feature.enabled?(:gitlab_experiment, type: :ops, default_enabled: :yaml)
feature_flag_instance.state != :off feature_flag_instance.state != :off
......
...@@ -20,7 +20,7 @@ module Gitlab ...@@ -20,7 +20,7 @@ module Gitlab
end end
def set_experimentation_subject_id_cookie def set_experimentation_subject_id_cookie
if Gitlab.dev_env_or_com? if Gitlab.com?
return if cookies[:experimentation_subject_id].present? return if cookies[:experimentation_subject_id].present?
cookies.permanent.signed[:experimentation_subject_id] = { cookies.permanent.signed[:experimentation_subject_id] = {
......
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
# Temporary change, we will change `experiment_percentage` in future to `Feature.enabled? # Temporary change, we will change `experiment_percentage` in future to `Feature.enabled?
Feature.enabled?(feature_flag_name, type: :experiment, default_enabled: :yaml) Feature.enabled?(feature_flag_name, type: :experiment, default_enabled: :yaml)
::Gitlab.dev_env_or_com? && experiment_percentage > 0 ::Gitlab.com? && experiment_percentage > 0
end end
def enabled_for_index?(index) def enabled_for_index?(index)
......
...@@ -40,7 +40,6 @@ module Gitlab ...@@ -40,7 +40,6 @@ module Gitlab
gon.ee = Gitlab.ee? gon.ee = Gitlab.ee?
gon.jh = Gitlab.jh? gon.jh = Gitlab.jh?
gon.dot_com = Gitlab.com? gon.dot_com = Gitlab.com?
gon.dev_env_or_com = Gitlab.dev_env_or_com?
if current_user if current_user
gon.current_user_id = current_user.id gon.current_user_id = current_user.id
......
...@@ -243,12 +243,12 @@ RSpec.describe ApplicationExperiment, :experiment do ...@@ -243,12 +243,12 @@ RSpec.describe ApplicationExperiment, :experiment do
with_them do with_them do
it "returns the url or nil if invalid" do it "returns the url or nil if invalid" do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
expect(application_experiment.process_redirect_url(url)).to eq(processed_url) expect(application_experiment.process_redirect_url(url)).to eq(processed_url)
end end
it "considers all urls invalid when not on dev or com" do it "considers all urls invalid when not on dev or com" do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) allow(Gitlab).to receive(:com?).and_return(false)
expect(application_experiment.process_redirect_url(url)).to be_nil expect(application_experiment.process_redirect_url(url)).to be_nil
end end
end end
......
...@@ -8,7 +8,7 @@ RSpec.describe SessionsHelper do ...@@ -8,7 +8,7 @@ RSpec.describe SessionsHelper do
context 'when on .com' do context 'when on .com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'when flash notice is empty it is false' do it 'when flash notice is empty it is false' do
...@@ -29,7 +29,7 @@ RSpec.describe SessionsHelper do ...@@ -29,7 +29,7 @@ RSpec.describe SessionsHelper do
context 'when not on .com' do context 'when not on .com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) allow(Gitlab).to receive(:com?).and_return(false)
end end
it 'when flash notice is devise confirmed message it is false' do it 'when flash notice is devise confirmed message it is false' do
......
...@@ -39,14 +39,14 @@ RSpec.describe WhatsNewHelper do ...@@ -39,14 +39,14 @@ RSpec.describe WhatsNewHelper do
subject { helper.display_whats_new? } subject { helper.display_whats_new? }
it 'returns true when gitlab.com' do it 'returns true when gitlab.com' do
allow(Gitlab).to receive(:dev_env_org_or_com?).and_return(true) allow(Gitlab).to receive(:org_or_com?).and_return(true)
expect(subject).to be true expect(subject).to be true
end end
context 'when self-managed' do context 'when self-managed' do
before do before do
allow(Gitlab).to receive(:dev_env_org_or_com?).and_return(false) allow(Gitlab).to receive(:org_or_com?).and_return(false)
end end
it 'returns true if user is signed in' do it 'returns true if user is signed in' do
...@@ -71,7 +71,7 @@ RSpec.describe WhatsNewHelper do ...@@ -71,7 +71,7 @@ RSpec.describe WhatsNewHelper do
with_them do with_them do
it 'returns correct result depending on variant' do it 'returns correct result depending on variant' do
allow(Gitlab).to receive(:dev_env_org_or_com?).and_return(true) allow(Gitlab).to receive(:org_or_com?).and_return(true)
Gitlab::CurrentSettings.update!(whats_new_variant: ApplicationSetting.whats_new_variants[variant]) Gitlab::CurrentSettings.update!(whats_new_variant: ApplicationSetting.whats_new_variants[variant])
expect(subject).to eq(result) expect(subject).to eq(result)
......
...@@ -11,7 +11,7 @@ RSpec.describe Gitlab::Experiment::Rollout::Feature, :experiment do ...@@ -11,7 +11,7 @@ RSpec.describe Gitlab::Experiment::Rollout::Feature, :experiment do
before do before do
stub_feature_flags(gitlab_experiment: true) stub_feature_flags(gitlab_experiment: true)
allow(subject).to receive(:feature_flag_defined?).and_return(true) allow(subject).to receive(:feature_flag_defined?).and_return(true)
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
allow(subject).to receive(:feature_flag_instance).and_return(double(state: :on)) allow(subject).to receive(:feature_flag_instance).and_return(double(state: :on))
end end
...@@ -26,7 +26,7 @@ RSpec.describe Gitlab::Experiment::Rollout::Feature, :experiment do ...@@ -26,7 +26,7 @@ RSpec.describe Gitlab::Experiment::Rollout::Feature, :experiment do
end end
it "isn't enabled if we're not in dev or dotcom environments" do it "isn't enabled if we're not in dev or dotcom environments" do
expect(Gitlab).to receive(:dev_env_or_com?).and_return(false) expect(Gitlab).to receive(:com?).and_return(false)
expect(subject).not_to be_enabled expect(subject).not_to be_enabled
end end
......
...@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Experimentation::ControllerConcern, type: :controller do ...@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Experimentation::ControllerConcern, type: :controller do
} }
) )
allow(Gitlab).to receive(:dev_env_or_com?).and_return(is_gitlab_com) allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
Feature.enable_percentage_of_time(:test_experiment_experiment_percentage, enabled_percentage) Feature.enable_percentage_of_time(:test_experiment_experiment_percentage, enabled_percentage)
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Experimentation::Experiment do ...@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Experimentation::Experiment do
describe '#active?' do describe '#active?' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(on_gitlab_com) allow(Gitlab).to receive(:com?).and_return(on_gitlab_com)
end end
subject { experiment.active? } subject { experiment.active? }
......
...@@ -80,36 +80,42 @@ RSpec.describe Gitlab do ...@@ -80,36 +80,42 @@ RSpec.describe Gitlab do
end end
describe '.com?' do describe '.com?' do
it "is true when on #{Gitlab::Saas.com_url}" do context 'when not simulating SaaS' do
stub_config_setting(url: Gitlab::Saas.com_url) before do
stub_env('GITLAB_SIMULATE_SAAS', '0')
end
expect(described_class.com?).to eq true it "is true when on #{Gitlab::Saas.com_url}" do
end stub_config_setting(url: Gitlab::Saas.com_url)
it "is true when on #{Gitlab::Saas.staging_com_url}" do expect(described_class.com?).to eq true
stub_config_setting(url: Gitlab::Saas.staging_com_url) end
expect(described_class.com?).to eq true it "is true when on #{Gitlab::Saas.staging_com_url}" do
end stub_config_setting(url: Gitlab::Saas.staging_com_url)
it 'is true when on other gitlab subdomain' do expect(described_class.com?).to eq true
url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://example.') end
stub_config_setting(url: url_with_subdomain)
expect(described_class.com?).to eq true it 'is true when on other gitlab subdomain' do
end url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://example.')
stub_config_setting(url: url_with_subdomain)
it 'is true when on other gitlab subdomain with hyphen' do expect(described_class.com?).to eq true
url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://test-example.') end
stub_config_setting(url: url_with_subdomain)
expect(described_class.com?).to eq true it 'is true when on other gitlab subdomain with hyphen' do
end url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://test-example.')
stub_config_setting(url: url_with_subdomain)
it 'is false when not on GitLab.com' do expect(described_class.com?).to eq true
stub_config_setting(url: 'http://example.com') end
expect(described_class.com?).to eq false it 'is false when not on GitLab.com' do
stub_config_setting(url: 'http://example.com')
expect(described_class.com?).to eq false
end
end end
it 'is true when GITLAB_SIMULATE_SAAS is true and in development' do it 'is true when GITLAB_SIMULATE_SAAS is true and in development' do
...@@ -210,31 +216,23 @@ RSpec.describe Gitlab do ...@@ -210,31 +216,23 @@ RSpec.describe Gitlab do
end end
end end
describe '.dev_env_org_or_com?' do describe '.org_or_com?' do
it 'is true when on .com' do it 'is true when on .com' do
allow(described_class).to receive_messages(com?: true, org?: false) allow(described_class).to receive_messages(com?: true, org?: false)
expect(described_class.dev_env_org_or_com?).to eq true expect(described_class.org_or_com?).to eq true
end end
it 'is true when org' do it 'is true when org' do
allow(described_class).to receive_messages(com?: false, org?: true) allow(described_class).to receive_messages(com?: false, org?: true)
expect(described_class.dev_env_org_or_com?).to eq true expect(described_class.org_or_com?).to eq true
end end
it 'is false when not dev, org or com' do it 'is false when not dev, org or com' do
allow(described_class).to receive_messages(com?: false, org?: false) allow(described_class).to receive_messages(com?: false, org?: false)
expect(described_class.dev_env_org_or_com?).to eq false expect(described_class.org_or_com?).to eq false
end
end
describe '.dev_env_or_com?' do
it 'is correctly calling com?' do
expect(described_class).to receive(:com?).and_call_original
expect(described_class.dev_env_or_com?).to eq false
end end
end end
......
...@@ -16,7 +16,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do ...@@ -16,7 +16,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do
context 'when the environment is dev or com' do context 'when the environment is dev or com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'sets the trial plan limits for ci_daily_pipeline_schedule_triggers' do it 'sets the trial plan limits for ci_daily_pipeline_schedule_triggers' do
...@@ -57,7 +57,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do ...@@ -57,7 +57,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do
context 'when the environment is anything other than dev or com' do context 'when the environment is anything other than dev or com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) allow(Gitlab).to receive(:com?).and_return(false)
end end
it 'does not update the plan limits' do it 'does not update the plan limits' do
...@@ -75,7 +75,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do ...@@ -75,7 +75,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do
context 'when the environment is dev or com' do context 'when the environment is dev or com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'sets the trial plan limits ci_daily_pipeline_schedule_triggers to zero' do it 'sets the trial plan limits ci_daily_pipeline_schedule_triggers to zero' do
...@@ -116,7 +116,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do ...@@ -116,7 +116,7 @@ RSpec.describe UpdateTrialPlansCiDailyPipelineScheduleTriggers, :migration do
context 'when the environment is anything other than dev or com' do context 'when the environment is anything other than dev or com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) allow(Gitlab).to receive(:com?).and_return(false)
end end
it 'does not change the ultimate trial plan limits' do it 'does not change the ultimate trial plan limits' do
......
...@@ -7,7 +7,7 @@ require_migration! ...@@ -7,7 +7,7 @@ require_migration!
RSpec.describe AddNewTrailPlans, :migration do RSpec.describe AddNewTrailPlans, :migration do
describe '#up' do describe '#up' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return true allow(Gitlab).to receive(:com?).and_return true
end end
it 'creates 2 entries within the plans table' do it 'creates 2 entries within the plans table' do
...@@ -40,7 +40,7 @@ RSpec.describe AddNewTrailPlans, :migration do ...@@ -40,7 +40,7 @@ RSpec.describe AddNewTrailPlans, :migration do
context 'when the instance is not SaaS' do context 'when the instance is not SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return false allow(Gitlab).to receive(:com?).and_return false
end end
it 'does not create plans and plan limits and returns' do it 'does not create plans and plan limits and returns' do
...@@ -58,7 +58,7 @@ RSpec.describe AddNewTrailPlans, :migration do ...@@ -58,7 +58,7 @@ RSpec.describe AddNewTrailPlans, :migration do
context 'when the instance is SaaS' do context 'when the instance is SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return true allow(Gitlab).to receive(:com?).and_return true
end end
it 'removes the newly added ultimate and premium trial entries' do it 'removes the newly added ultimate and premium trial entries' do
...@@ -77,7 +77,7 @@ RSpec.describe AddNewTrailPlans, :migration do ...@@ -77,7 +77,7 @@ RSpec.describe AddNewTrailPlans, :migration do
context 'when the instance is not SaaS' do context 'when the instance is not SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return false allow(Gitlab).to receive(:com?).and_return false
table(:plans).create!(id: 1, name: 'ultimate_trial', title: 'Ultimate Trial') table(:plans).create!(id: 1, name: 'ultimate_trial', title: 'Ultimate Trial')
table(:plans).create!(id: 2, name: 'premium_trial', title: 'Premium Trial') table(:plans).create!(id: 2, name: 'premium_trial', title: 'Premium Trial')
table(:plan_limits).create!(id: 1, plan_id: 1) table(:plan_limits).create!(id: 1, plan_id: 1)
......
...@@ -7,7 +7,7 @@ require_migration! ...@@ -7,7 +7,7 @@ require_migration!
RSpec.describe AddOpenSourcePlan, :migration do RSpec.describe AddOpenSourcePlan, :migration do
describe '#up' do describe '#up' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return true allow(Gitlab).to receive(:com?).and_return true
end end
it 'creates 1 entry within the plans table' do it 'creates 1 entry within the plans table' do
...@@ -35,7 +35,7 @@ RSpec.describe AddOpenSourcePlan, :migration do ...@@ -35,7 +35,7 @@ RSpec.describe AddOpenSourcePlan, :migration do
context 'when the instance is not SaaS' do context 'when the instance is not SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return false allow(Gitlab).to receive(:com?).and_return false
end end
it 'does not create plans and plan limits and returns' do it 'does not create plans and plan limits and returns' do
...@@ -52,7 +52,7 @@ RSpec.describe AddOpenSourcePlan, :migration do ...@@ -52,7 +52,7 @@ RSpec.describe AddOpenSourcePlan, :migration do
context 'when the instance is SaaS' do context 'when the instance is SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return true allow(Gitlab).to receive(:com?).and_return true
end end
it 'removes the newly added opensource entry' do it 'removes the newly added opensource entry' do
...@@ -70,7 +70,7 @@ RSpec.describe AddOpenSourcePlan, :migration do ...@@ -70,7 +70,7 @@ RSpec.describe AddOpenSourcePlan, :migration do
context 'when the instance is not SaaS' do context 'when the instance is not SaaS' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return false allow(Gitlab).to receive(:com?).and_return false
table(:plans).create!(id: 1, name: 'opensource', title: 'Open Source Program') table(:plans).create!(id: 1, name: 'opensource', title: 'Open Source Program')
table(:plan_limits).create!(id: 1, plan_id: 1) table(:plan_limits).create!(id: 1, plan_id: 1)
end end
......
...@@ -9,7 +9,7 @@ RSpec.describe 'devise/sessions/new' do ...@@ -9,7 +9,7 @@ RSpec.describe 'devise/sessions/new' do
before do before do
stub_devise stub_devise
disable_captcha disable_captcha
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'when flash is anything it renders marketing text' do it 'when flash is anything it renders marketing text' do
......
...@@ -27,7 +27,7 @@ RSpec.describe 'devise/shared/_signup_box' do ...@@ -27,7 +27,7 @@ RSpec.describe 'devise/shared/_signup_box' do
context 'when on .com' do context 'when on .com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'shows expected GitLab text' do it 'shows expected GitLab text' do
...@@ -39,7 +39,7 @@ RSpec.describe 'devise/shared/_signup_box' do ...@@ -39,7 +39,7 @@ RSpec.describe 'devise/shared/_signup_box' do
context 'when not on .com' do context 'when not on .com' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false) allow(Gitlab).to receive(:com?).and_return(false)
end end
it 'shows expected text without GitLab' do it 'shows expected text without GitLab' do
...@@ -53,7 +53,7 @@ RSpec.describe 'devise/shared/_signup_box' do ...@@ -53,7 +53,7 @@ RSpec.describe 'devise/shared/_signup_box' do
context 'when terms are not enforced' do context 'when terms are not enforced' do
before do before do
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:enforce_terms?).and_return(false) allow(Gitlab::CurrentSettings.current_application_settings).to receive(:enforce_terms?).and_return(false)
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'shows expected text with placeholders' do it 'shows expected text with placeholders' do
......
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