Commit 202d0774 authored by Doug Stull's avatar Doug Stull

Replace uses of dev_env_or_com with com

- dev_env_or_com is the same thing as com, so we don't need both
parent 9e3b832e
...@@ -12,7 +12,7 @@ module EE ...@@ -12,7 +12,7 @@ module EE
end end
def check_if_gl_com_or_dev def check_if_gl_com_or_dev
render_404 unless ::Gitlab.dev_env_or_com? render_404 unless ::Gitlab.com?
end end
def verify_namespace_plan_check_enabled def verify_namespace_plan_check_enabled
......
...@@ -52,7 +52,7 @@ module EE ...@@ -52,7 +52,7 @@ module EE
def update_params def update_params
clean_params = super.merge(params.require(:user).permit(:email_opted_in, :registration_objective)) clean_params = super.merge(params.require(:user).permit(:email_opted_in, :registration_objective))
return clean_params unless ::Gitlab.dev_env_or_com? return clean_params unless ::Gitlab.com?
clean_params[:email_opted_in] = '1' if clean_params[:setup_for_company] == 'true' clean_params[:email_opted_in] = '1' if clean_params[:setup_for_company] == 'true'
......
...@@ -19,7 +19,7 @@ class SurveyResponsesController < ApplicationController ...@@ -19,7 +19,7 @@ class SurveyResponsesController < ApplicationController
private private
def track_response def track_response
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
data = { data = {
survey_id: to_number(params[:survey_id]), survey_id: to_number(params[:survey_id]),
...@@ -42,7 +42,7 @@ class SurveyResponsesController < ApplicationController ...@@ -42,7 +42,7 @@ class SurveyResponsesController < ApplicationController
end end
def set_invite_link def set_invite_link
return unless Gitlab.dev_env_or_com? return unless Gitlab.com?
return unless Gitlab::Utils.to_boolean(params[:show_invite_link]) return unless Gitlab::Utils.to_boolean(params[:show_invite_link])
return unless Feature.enabled?(:calendly_invite_link) return unless Feature.enabled?(:calendly_invite_link)
......
...@@ -4,7 +4,7 @@ module EE ...@@ -4,7 +4,7 @@ module EE
module Ci module Ci
module PipelinesHelper module PipelinesHelper
def show_cc_validation_alert?(pipeline) def show_cc_validation_alert?(pipeline)
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false if pipeline.user.blank? || current_user != pipeline.user return false if pipeline.user.blank? || current_user != pipeline.user
pipeline.user_not_verified? && !pipeline.user.has_required_credit_card_to_run_pipelines?(pipeline.project) pipeline.user_not_verified? && !pipeline.user.has_required_credit_card_to_run_pipelines?(pipeline.project)
......
...@@ -17,20 +17,20 @@ module EE ...@@ -17,20 +17,20 @@ module EE
end end
def show_buy_pipeline_minutes?(project, namespace) def show_buy_pipeline_minutes?(project, namespace)
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
show_out_of_pipeline_minutes_notification?(project, namespace) show_out_of_pipeline_minutes_notification?(project, namespace)
end end
def show_pipeline_minutes_notification_dot?(project, namespace) def show_pipeline_minutes_notification_dot?(project, namespace)
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false if notification_dot_acknowledged? return false if notification_dot_acknowledged?
show_out_of_pipeline_minutes_notification?(project, namespace) show_out_of_pipeline_minutes_notification?(project, namespace)
end end
def show_buy_pipeline_with_subtext?(project, namespace) def show_buy_pipeline_with_subtext?(project, namespace)
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false unless notification_dot_acknowledged? return false unless notification_dot_acknowledged?
show_out_of_pipeline_minutes_notification?(project, namespace) show_out_of_pipeline_minutes_notification?(project, namespace)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module EE module EE
module TrialRegistrationHelper module TrialRegistrationHelper
def social_signin_enabled? def social_signin_enabled?
::Gitlab.dev_env_or_com? && ::Gitlab.com? &&
omniauth_enabled? && omniauth_enabled? &&
devise_mapping.omniauthable? && devise_mapping.omniauthable? &&
button_based_providers_enabled? button_based_providers_enabled?
......
...@@ -104,7 +104,7 @@ module EE ...@@ -104,7 +104,7 @@ module EE
end end
def show_verification_reminder? def show_verification_reminder?
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false unless ::Feature.enabled?(:verification_reminder, default_enabled: :yaml) return false unless ::Feature.enabled?(:verification_reminder, default_enabled: :yaml)
return false unless current_user return false unless current_user
return false if current_user.has_valid_credit_card? return false if current_user.has_valid_credit_card?
......
...@@ -69,7 +69,7 @@ module EE ...@@ -69,7 +69,7 @@ module EE
end end
def signup_onboarding_enabled? def signup_onboarding_enabled?
::Gitlab.dev_env_or_com? ::Gitlab.com?
end end
end end
end end
...@@ -26,7 +26,7 @@ module SeatsCountAlertHelper ...@@ -26,7 +26,7 @@ module SeatsCountAlertHelper
end end
def show_seats_count_alert? def show_seats_count_alert?
return false unless ::Gitlab.dev_env_or_com? && group_with_owner? && current_subscription return false unless ::Gitlab.com? && group_with_owner? && current_subscription
return false if user_dismissed_alert? return false if user_dismissed_alert?
!!@display_seats_count_alert !!@display_seats_count_alert
......
...@@ -455,7 +455,7 @@ module EE ...@@ -455,7 +455,7 @@ module EE
end end
def requires_credit_card?(project) def requires_credit_card?(project)
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false unless created_after_credit_card_release_day?(project) return false unless created_after_credit_card_release_day?(project)
root_namespace = project.root_namespace root_namespace = project.root_namespace
......
...@@ -160,7 +160,7 @@ class GitlabSubscription < ApplicationRecord ...@@ -160,7 +160,7 @@ class GitlabSubscription < ApplicationRecord
end end
def automatically_index_in_elasticsearch? def automatically_index_in_elasticsearch?
return false unless ::Gitlab.dev_env_or_com? return false unless ::Gitlab.com?
return false if expired? return false if expired?
# We only index paid groups on dot com for now. # We only index paid groups on dot com for now.
......
...@@ -194,7 +194,7 @@ module EE ...@@ -194,7 +194,7 @@ module EE
def send_account_validation_email(pipeline) def send_account_validation_email(pipeline)
return unless ::Feature.enabled?(:account_validation_email) return unless ::Feature.enabled?(:account_validation_email)
return unless ::Gitlab.dev_env_or_com? return unless ::Gitlab.com?
return unless pipeline.failed? return unless pipeline.failed?
return unless pipeline.user_not_verified? return unless pipeline.user_not_verified?
......
- return unless Gitlab.dev_env_or_com? - return unless Gitlab.com?
- expanded = integration_expanded?('slack_app_') - expanded = integration_expanded?('slack_app_')
%section.settings.as-slack.no-animate#js-slack-settings{ class: ('expanded' if expanded) } %section.settings.as-slack.no-animate#js-slack-settings{ class: ('expanded' if expanded) }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.pipeline-quota.container-fluid .pipeline-quota.container-fluid
.row .row
.col-sm-6.offset-sm-6 .col-sm-6.offset-sm-6
- if ::Gitlab.dev_env_or_com? - if ::Gitlab.com?
= link_to s_('UsageQuota|Buy additional minutes'), = link_to s_('UsageQuota|Buy additional minutes'),
buy_additional_minutes_path(namespace), buy_additional_minutes_path(namespace),
target: buy_addon_target_attr(namespace), target: buy_addon_target_attr(namespace),
......
- return unless Gitlab.dev_env_or_com? - return unless Gitlab.com?
- return if in_trial_flow? - return if in_trial_flow?
- experiment(:bypass_registration, user: current_user) do |e| - experiment(:bypass_registration, user: current_user) do |e|
......
- return unless Gitlab.dev_env_or_com? - return unless Gitlab.com?
- if user_has_memberships? - if user_has_memberships?
= f.hidden_field :setup_for_company, value: true = f.hidden_field :setup_for_company, value: true
......
...@@ -12,7 +12,7 @@ class ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker ...@@ -12,7 +12,7 @@ class ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker
idempotent! idempotent!
def perform def perform
return unless ::Gitlab.dev_env_or_com? return unless ::Gitlab.com?
in_lock(self.class.name.underscore, ttl: 1.hour, retries: 0) do in_lock(self.class.name.underscore, ttl: 1.hour, retries: 0) do
GitlabSubscription.yield_long_expired_indexed_namespaces do |indexed_namespace| GitlabSubscription.yield_long_expired_indexed_namespaces do |indexed_namespace|
......
...@@ -11,7 +11,7 @@ module EE ...@@ -11,7 +11,7 @@ module EE
gon.roadmap_epics_limit = 1000 gon.roadmap_epics_limit = 1000
if ::Gitlab.dev_env_or_com? if ::Gitlab.com?
gon.subscriptions_url = ::Gitlab::SubscriptionPortal::SUBSCRIPTIONS_URL gon.subscriptions_url = ::Gitlab::SubscriptionPortal::SUBSCRIPTIONS_URL
gon.payment_form_url = ::Gitlab::SubscriptionPortal::PAYMENT_FORM_URL gon.payment_form_url = ::Gitlab::SubscriptionPortal::PAYMENT_FORM_URL
gon.registration_validation_form_url = ::Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_URL gon.registration_validation_form_url = ::Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_URL
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
def self.gitlab_com_group_member?(user_id) def self.gitlab_com_group_member?(user_id)
return false unless user_id return false unless user_id
Gitlab.dev_env_or_com? && gitlab_com_user_ids.include?(user_id) Gitlab.com? && gitlab_com_user_ids.include?(user_id)
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
...@@ -13,7 +13,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -13,7 +13,7 @@ RSpec.describe Registrations::GroupsController do
let_it_be(:trial_form_params) { { trial: 'false' } } let_it_be(:trial_form_params) { { trial: 'false' } }
let_it_be(:trial_onboarding_flow_params) { {} } let_it_be(:trial_onboarding_flow_params) { {} }
let(:dev_env_or_com) { true } let(:com) { true }
let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, create_event: true, setup_for_company: setup_for_company } } let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, create_event: true, setup_for_company: setup_for_company } }
let(:setup_for_company) { nil } let(:setup_for_company) { nil }
let(:params) do let(:params) do
...@@ -30,7 +30,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -30,7 +30,7 @@ RSpec.describe Registrations::GroupsController do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
context 'when on .com' do context 'when on .com' do
...@@ -235,7 +235,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -235,7 +235,7 @@ RSpec.describe Registrations::GroupsController do
end end
context 'when not on .com' do context 'when not on .com' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -15,7 +15,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -15,7 +15,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
subject { get :new } subject { get :new }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
sign_in(user) sign_in(user)
end end
...@@ -64,7 +64,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -64,7 +64,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
let(:extra_params) { {} } let(:extra_params) { {} }
let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, setup_for_company: setup_for_company } } let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, setup_for_company: setup_for_company } }
let(:project_params) { { name: 'New project', path: 'project-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE, initialize_with_readme: 'true' } } let(:project_params) { { name: 'New project', path: 'project-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE, initialize_with_readme: 'true' } }
let(:dev_env_or_com) { true } let(:com) { true }
let(:setup_for_company) { nil } let(:setup_for_company) { nil }
let(:combined_registration?) { true } let(:combined_registration?) { true }
...@@ -76,7 +76,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -76,7 +76,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
it_behaves_like 'hides email confirmation warning' it_behaves_like 'hides email confirmation warning'
...@@ -155,7 +155,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -155,7 +155,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
end end
context 'with signup onboarding not enabled' do context 'with signup onboarding not enabled' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
...@@ -339,7 +339,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -339,7 +339,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
let(:params) { { group: group_params, import_url: new_import_github_path } } let(:params) { { group: group_params, import_url: new_import_github_path } }
let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, setup_for_company: nil } } let(:group_params) { { name: 'Group name', path: 'group-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s, setup_for_company: nil } }
let(:dev_env_or_com) { true } let(:com) { true }
context 'with an unauthenticated user' do context 'with an unauthenticated user' do
it { is_expected.to have_gitlab_http_status(:redirect) } it { is_expected.to have_gitlab_http_status(:redirect) }
...@@ -349,7 +349,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -349,7 +349,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
it_behaves_like 'hides email confirmation warning' it_behaves_like 'hides email confirmation warning'
...@@ -421,7 +421,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do ...@@ -421,7 +421,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
end end
it { is_expected.to have_gitlab_http_status(:redirect) } it { is_expected.to have_gitlab_http_status(:redirect) }
......
...@@ -16,11 +16,11 @@ RSpec.describe Registrations::ProjectsController do ...@@ -16,11 +16,11 @@ RSpec.describe Registrations::ProjectsController do
end end
context 'with an authenticated user' do context 'with an authenticated user' do
let(:dev_env_or_com) { true } let(:com) { true }
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
context 'when on .com' do context 'when on .com' do
...@@ -43,7 +43,7 @@ RSpec.describe Registrations::ProjectsController do ...@@ -43,7 +43,7 @@ RSpec.describe Registrations::ProjectsController do
end end
context 'when not on .com' do context 'when not on .com' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -14,11 +14,11 @@ RSpec.describe Registrations::VerificationController do ...@@ -14,11 +14,11 @@ RSpec.describe Registrations::VerificationController do
end end
context 'with an authenticated user' do context 'with an authenticated user' do
let(:dev_env_or_com) { true } let(:com) { true }
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
context 'when on .com' do context 'when on .com' do
...@@ -36,7 +36,7 @@ RSpec.describe Registrations::VerificationController do ...@@ -36,7 +36,7 @@ RSpec.describe Registrations::VerificationController do
end end
context 'when not on .com' do context 'when not on .com' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe TrialRegistrationsController do RSpec.describe TrialRegistrationsController do
let(:dev_env_or_com) { true } let(:com) { true }
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(Gitlab).to receive(:com?).and_return(com)
end end
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 and not in development environment' do context 'when not on gitlab.com and not in development environment' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -5,11 +5,9 @@ require 'spec_helper' ...@@ -5,11 +5,9 @@ require 'spec_helper'
RSpec.describe TrialsController, :saas do RSpec.describe TrialsController, :saas do
let_it_be(:user) { create(:user, email_opted_in: true, last_name: 'Doe') } let_it_be(:user) { create(:user, email_opted_in: true, last_name: 'Doe') }
let(:dev_env_or_com) { true }
let(:logged_in) { true } let(:logged_in) { true }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
sign_in(user) if logged_in sign_in(user) if logged_in
end end
...@@ -30,13 +28,15 @@ RSpec.describe TrialsController, :saas do ...@@ -30,13 +28,15 @@ 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 and not in development environment' do context 'when not on gitlab.com ' do
let(:dev_env_or_com) { false } before do
allow(::Gitlab).to receive(:com?).and_return(false)
end
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
context 'when on gitlab.com or in dev environment' do context 'when on gitlab.com' do
it { is_expected.to have_gitlab_http_status(success_status) } it { is_expected.to have_gitlab_http_status(success_status) }
end end
end end
......
...@@ -10,7 +10,7 @@ RSpec.describe 'GitLab.com Google Analytics DataLayer', :js do ...@@ -10,7 +10,7 @@ RSpec.describe 'GitLab.com Google Analytics DataLayer', :js do
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
stub_application_setting(require_admin_approval_after_user_signup: false) stub_application_setting(require_admin_approval_after_user_signup: false)
stub_feature_flags(gitlab_gtm_datalayer: true) stub_feature_flags(gitlab_gtm_datalayer: true)
stub_config(extra: { google_tag_manager_id: google_tag_manager_id, google_tag_manager_nonce_id: google_tag_manager_id }) stub_config(extra: { google_tag_manager_id: google_tag_manager_id, google_tag_manager_nonce_id: google_tag_manager_id })
......
...@@ -7,11 +7,11 @@ RSpec.describe 'Group or Project invitations' do ...@@ -7,11 +7,11 @@ RSpec.describe 'Group or Project invitations' do
let(:project) { create(:project, :repository, namespace: group) } let(:project) { create(:project, :repository, namespace: group) }
let(:group_invite) { create(:group_member, :invited, group: group) } let(:group_invite) { create(:group_member, :invited, group: group) }
let(:new_user) { build_stubbed(:user, email: group_invite.invite_email) } let(:new_user) { build_stubbed(:user, email: group_invite.invite_email) }
let(:dev_env_or_com) { true } let(:com) { true }
before do before do
stub_application_setting(require_admin_approval_after_user_signup: false) stub_application_setting(require_admin_approval_after_user_signup: false)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
visit invite_path(group_invite.raw_invite_token) visit invite_path(group_invite.raw_invite_token)
end end
...@@ -47,7 +47,7 @@ RSpec.describe 'Group or Project invitations' do ...@@ -47,7 +47,7 @@ RSpec.describe 'Group or Project invitations' do
end end
context 'when not on .com' do context 'when not on .com' do
let(:dev_env_or_com) { false } let(:com) { false }
it 'bypasses the setup_for_company question' do it 'bypasses the setup_for_company question' do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
......
...@@ -11,7 +11,7 @@ RSpec.describe 'OneTrust in the sign up flow' do ...@@ -11,7 +11,7 @@ RSpec.describe 'OneTrust in the sign up flow' do
before do before do
stub_config(extra: { one_trust_id: one_trust_id }) stub_config(extra: { one_trust_id: one_trust_id })
stub_feature_flags(ecomm_instrumentation: true) stub_feature_flags(ecomm_instrumentation: true)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
sign_in(user) sign_in(user)
end end
......
...@@ -45,7 +45,7 @@ RSpec.describe EE::Ci::PipelinesHelper do ...@@ -45,7 +45,7 @@ RSpec.describe EE::Ci::PipelinesHelper do
let(:pipeline) { instance_double(Ci::Pipeline) } let(:pipeline) { instance_double(Ci::Pipeline) }
before do before do
allow(Gitlab).to receive(:dev_env_or_com?) { false } allow(Gitlab).to receive(:com?) { false }
end end
it { is_expected.to be_falsy } it { is_expected.to be_falsy }
......
...@@ -22,7 +22,7 @@ RSpec.describe EE::Ci::RunnersHelper do ...@@ -22,7 +22,7 @@ RSpec.describe EE::Ci::RunnersHelper do
context 'with a project and namespace' do context 'with a project and namespace' do
context 'when not on dot com' do context 'when not on dot com' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
...@@ -106,7 +106,7 @@ RSpec.describe EE::Ci::RunnersHelper do ...@@ -106,7 +106,7 @@ RSpec.describe EE::Ci::RunnersHelper do
end end
context 'with notifications' do context 'with notifications' do
let(:dev_env_or_com) { true } let(:com) { true }
describe '.show_buy_pipeline_minutes?' do describe '.show_buy_pipeline_minutes?' do
subject { helper.show_buy_pipeline_minutes?(project, namespace) } subject { helper.show_buy_pipeline_minutes?(project, namespace) }
...@@ -114,7 +114,7 @@ RSpec.describe EE::Ci::RunnersHelper do ...@@ -114,7 +114,7 @@ RSpec.describe EE::Ci::RunnersHelper do
context 'when on dot com' do context 'when on dot com' do
it_behaves_like 'minutes notification' do it_behaves_like 'minutes notification' do
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
end end
end end
...@@ -124,7 +124,7 @@ RSpec.describe EE::Ci::RunnersHelper do ...@@ -124,7 +124,7 @@ RSpec.describe EE::Ci::RunnersHelper do
subject { helper.show_pipeline_minutes_notification_dot?(project, namespace) } subject { helper.show_pipeline_minutes_notification_dot?(project, namespace) }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
it_behaves_like 'minutes notification' it_behaves_like 'minutes notification'
...@@ -151,7 +151,7 @@ RSpec.describe EE::Ci::RunnersHelper do ...@@ -151,7 +151,7 @@ RSpec.describe EE::Ci::RunnersHelper do
subject { helper.show_buy_pipeline_with_subtext?(project, namespace) } subject { helper.show_buy_pipeline_with_subtext?(project, namespace) }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
context 'when the notification dot has not been acknowledged' do context 'when the notification dot has not been acknowledged' do
......
...@@ -7,7 +7,7 @@ RSpec.describe EE::TrialRegistrationHelper do ...@@ -7,7 +7,7 @@ RSpec.describe EE::TrialRegistrationHelper do
describe '#social_signin_enabled?' do describe '#social_signin_enabled?' do
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(com) allow(::Gitlab).to receive(:com?).and_return(com)
allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled) allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled)
allow(view).to receive(:button_based_providers_enabled?).and_return(button_based_providers_enabled) allow(view).to receive(:button_based_providers_enabled?).and_return(button_based_providers_enabled)
allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable)) allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable))
......
...@@ -431,7 +431,7 @@ RSpec.describe EE::Users::CalloutsHelper do ...@@ -431,7 +431,7 @@ RSpec.describe EE::Users::CalloutsHelper do
with_them do with_them 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?)
allow(helper).to receive(:current_user).and_return(logged_in? ? user : nil) allow(helper).to receive(:current_user).and_return(logged_in? ? user : nil)
allow(user).to receive(:has_valid_credit_card?).and_return(!unverified?) allow(user).to receive(:has_valid_credit_card?).and_return(!unverified?)
pipeline.update!(failure_reason: nil) unless failed_pipeline? pipeline.update!(failure_reason: nil) unless failed_pipeline?
...@@ -444,7 +444,7 @@ RSpec.describe EE::Users::CalloutsHelper do ...@@ -444,7 +444,7 @@ RSpec.describe EE::Users::CalloutsHelper do
describe 'dismissing the alert timing' do describe 'dismissing the alert timing' do
before do before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
create(:callout, user: user, feature_name: :verification_reminder, dismissed_at: Time.current) create(:callout, user: user, feature_name: :verification_reminder, dismissed_at: Time.current)
create(:ci_pipeline, user: user, failure_reason: :user_not_verified, created_at: pipeline_created_at) create(:ci_pipeline, user: user, failure_reason: :user_not_verified, created_at: pipeline_created_at)
......
...@@ -28,7 +28,7 @@ RSpec.describe EE::Gitlab::GonHelper do ...@@ -28,7 +28,7 @@ RSpec.describe EE::Gitlab::GonHelper do
context 'when GitLab.com' do context 'when GitLab.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 'includes CustomersDot variables' do it 'includes CustomersDot variables' do
......
...@@ -1751,7 +1751,7 @@ RSpec.describe User do ...@@ -1751,7 +1751,7 @@ RSpec.describe User do
with_them do with_them do
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(saas == :saas) allow(::Gitlab).to receive(:com?).and_return(saas == :saas)
user.created_at = ::Users::CreditCardValidation::RELEASE_DAY + days_from_release.days user.created_at = ::Users::CreditCardValidation::RELEASE_DAY + days_from_release.days
allow(user).to receive(:credit_card_validated_at).and_return(Time.current) if cc_present allow(user).to receive(:credit_card_validated_at).and_return(Time.current) if cc_present
allow(project.namespace).to receive(:free_plan?).and_return(plan == :free) allow(project.namespace).to receive(:free_plan?).and_return(plan == :free)
...@@ -1805,7 +1805,7 @@ RSpec.describe User do ...@@ -1805,7 +1805,7 @@ RSpec.describe User do
with_them do with_them do
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(saas == :saas) allow(::Gitlab).to receive(:com?).and_return(saas == :saas)
user.created_at = ::Users::CreditCardValidation::RELEASE_DAY + days_from_release.days user.created_at = ::Users::CreditCardValidation::RELEASE_DAY + days_from_release.days
allow(user).to receive(:credit_card_validated_at).and_return(Time.current) if cc_present allow(user).to receive(:credit_card_validated_at).and_return(Time.current) if cc_present
allow(project.namespace).to receive(:free_plan?).and_return(plan == :free) allow(project.namespace).to receive(:free_plan?).and_return(plan == :free)
......
...@@ -367,12 +367,10 @@ RSpec.describe GitlabSubscription, :saas do ...@@ -367,12 +367,10 @@ RSpec.describe GitlabSubscription, :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) }
let(:dev_env_or_com) { true }
let(:expiration_date) { Date.today + 10 } let(:expiration_date) { Date.today + 10 }
let(:plan) { :bronze } let(:plan) { :bronze }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
gitlab_subscription.end_date = expiration_date gitlab_subscription.end_date = expiration_date
end end
...@@ -423,8 +421,10 @@ RSpec.describe GitlabSubscription, :saas do ...@@ -423,8 +421,10 @@ RSpec.describe GitlabSubscription, :saas do
end end
end end
context 'when not ::Gitlab.dev_env_or_com?' do context 'when not ::Gitlab.com?' do
let(:dev_env_or_com) { false } before do
allow(::Gitlab).to receive(:com?).and_return(false)
end
it 'does not index the namespace' do it 'does not index the namespace' do
expect(ElasticsearchIndexedNamespace).not_to receive(:safe_find_or_create_by!) expect(ElasticsearchIndexedNamespace).not_to receive(:safe_find_or_create_by!)
...@@ -579,7 +579,7 @@ RSpec.describe GitlabSubscription, :saas do ...@@ -579,7 +579,7 @@ RSpec.describe GitlabSubscription, :saas do
let_it_be(:expired_subscription2) { create(:gitlab_subscription, :bronze, end_date: Date.today - 40) } let_it_be(:expired_subscription2) { create(:gitlab_subscription, :bronze, end_date: Date.today - 40) }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription1.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription1.namespace_id)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription2.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription2.namespace_id)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: recently_expired_subscription.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: recently_expired_subscription.namespace_id)
......
...@@ -5,14 +5,14 @@ require 'spec_helper' ...@@ -5,14 +5,14 @@ require 'spec_helper'
RSpec.describe Projects::Pipelines::EmailCampaignsController do RSpec.describe Projects::Pipelines::EmailCampaignsController do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:dev_env_or_com) { true } let(:com) { true }
subject(:request) do subject(:request) do
get project_pipeline_validate_account_path(project, pipeline) get project_pipeline_validate_account_path(project, pipeline)
end end
before do before do
allow(Gitlab).to receive(:dev_env_or_com?) { dev_env_or_com } allow(Gitlab).to receive(:com?) { com }
end end
describe 'GET #validate_account', :snowplow do describe 'GET #validate_account', :snowplow do
...@@ -49,7 +49,7 @@ RSpec.describe Projects::Pipelines::EmailCampaignsController do ...@@ -49,7 +49,7 @@ RSpec.describe Projects::Pipelines::EmailCampaignsController do
end end
context 'when not in .com or dev env' do context 'when not in .com or dev env' do
let(:dev_env_or_com) { false } let(:com) { false }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe SurveyResponsesController do RSpec.describe SurveyResponsesController do
describe 'GET #index' do describe 'GET #index' do
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(ondotcom) allow(::Gitlab).to receive(:com?).and_return(ondotcom)
end end
subject(:request) { get survey_responses_path(params) } subject(:request) { get survey_responses_path(params) }
......
...@@ -1009,7 +1009,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -1009,7 +1009,7 @@ RSpec.describe EE::NotificationService, :mailer do
subject(:pipeline_finished) { NotificationService.new.pipeline_finished(pipeline) } subject(:pipeline_finished) { NotificationService.new.pipeline_finished(pipeline) }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
allow(user).to receive(:has_required_credit_card_to_run_pipelines?).and_return(has_required_credit_card_to_run_pipelines) allow(user).to receive(:has_required_credit_card_to_run_pipelines?).and_return(has_required_credit_card_to_run_pipelines)
project.add_maintainer(user) project.add_maintainer(user)
...@@ -1040,7 +1040,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -1040,7 +1040,7 @@ RSpec.describe EE::NotificationService, :mailer do
context 'when not in dev env or gitlab.com' do context 'when not in dev env or gitlab.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
include_examples 'does not send account activation email' include_examples 'does not send account activation email'
......
...@@ -24,7 +24,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do ...@@ -24,7 +24,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:dev_env_or_com) { true } let(:com) { true }
subject { get :new } subject { get :new }
...@@ -36,7 +36,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do ...@@ -36,7 +36,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
end end
context 'when on .com' do context 'when on .com' do
...@@ -64,7 +64,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do ...@@ -64,7 +64,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
end end
context 'when not on .com' do context 'when not on .com' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -9,7 +9,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do ...@@ -9,7 +9,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
let_it_be(:first_project) { create(:project) } let_it_be(:first_project) { create(:project) }
let(:params) { { namespace_id: namespace.id, name: 'New project', path: 'project-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE } } let(:params) { { namespace_id: namespace.id, name: 'New project', path: 'project-path', visibility_level: Gitlab::VisibilityLevel::PRIVATE } }
let(:dev_env_or_com) { true } let(:com) { true }
let(:extra_params) { {} } let(:extra_params) { {} }
let(:success_path) { nil } let(:success_path) { nil }
let(:stored_location_for) { nil } let(:stored_location_for) { nil }
...@@ -23,7 +23,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do ...@@ -23,7 +23,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
before do before do
namespace.add_owner(user) namespace.add_owner(user)
sign_in(user) sign_in(user)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:com?).and_return(com)
allow(controller).to receive(:experiment).and_call_original allow(controller).to receive(:experiment).and_call_original
end end
...@@ -132,7 +132,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do ...@@ -132,7 +132,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
end end
context 'with signup onboarding not enabled' do context 'with signup onboarding not enabled' do
let(:dev_env_or_com) { false } let(:com) { false }
it { is_expected.to have_gitlab_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
......
...@@ -12,7 +12,7 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s ...@@ -12,7 +12,7 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s
let(:expired_subscription2) { create(:gitlab_subscription, :bronze, end_date: Date.today - 35) } let(:expired_subscription2) { create(:gitlab_subscription, :bronze, end_date: Date.today - 35) }
before do before do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true) allow(::Gitlab).to receive(:com?).and_return(true)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription1.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription1.namespace_id)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription2.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: not_expired_subscription2.namespace_id)
ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: recently_expired_subscription.namespace_id) ElasticsearchIndexedNamespace.safe_find_or_create_by!(namespace_id: recently_expired_subscription.namespace_id)
...@@ -35,9 +35,9 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s ...@@ -35,9 +35,9 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s
end end
end end
context 'when not dev_env_or_com?' do context 'when not 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 nothing' do it 'does nothing' 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