Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
202d0774
Commit
202d0774
authored
Mar 03, 2022
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
83 additions
and
83 deletions
+83
-83
ee/app/controllers/ee/application_controller.rb
ee/app/controllers/ee/application_controller.rb
+1
-1
ee/app/controllers/ee/registrations/welcome_controller.rb
ee/app/controllers/ee/registrations/welcome_controller.rb
+1
-1
ee/app/controllers/survey_responses_controller.rb
ee/app/controllers/survey_responses_controller.rb
+2
-2
ee/app/helpers/ee/ci/pipelines_helper.rb
ee/app/helpers/ee/ci/pipelines_helper.rb
+1
-1
ee/app/helpers/ee/ci/runners_helper.rb
ee/app/helpers/ee/ci/runners_helper.rb
+3
-3
ee/app/helpers/ee/trial_registration_helper.rb
ee/app/helpers/ee/trial_registration_helper.rb
+1
-1
ee/app/helpers/ee/users/callouts_helper.rb
ee/app/helpers/ee/users/callouts_helper.rb
+1
-1
ee/app/helpers/ee/welcome_helper.rb
ee/app/helpers/ee/welcome_helper.rb
+1
-1
ee/app/helpers/seats_count_alert_helper.rb
ee/app/helpers/seats_count_alert_helper.rb
+1
-1
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+1
-1
ee/app/models/gitlab_subscription.rb
ee/app/models/gitlab_subscription.rb
+1
-1
ee/app/services/ee/notification_service.rb
ee/app/services/ee/notification_service.rb
+1
-1
ee/app/views/admin/application_settings/_slack.html.haml
ee/app/views/admin/application_settings/_slack.html.haml
+1
-1
ee/app/views/namespaces/pipelines_quota/_list.haml
ee/app/views/namespaces/pipelines_quota/_list.haml
+1
-1
ee/app/views/registrations/welcome/_joining_project.html.haml
...pp/views/registrations/welcome/_joining_project.html.haml
+1
-1
ee/app/views/registrations/welcome/_setup_for_company.html.haml
.../views/registrations/welcome/_setup_for_company.html.haml
+1
-1
ee/app/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker.rb
...expired_namespace_subscriptions_from_index_cron_worker.rb
+1
-1
ee/lib/ee/gitlab/gon_helper.rb
ee/lib/ee/gitlab/gon_helper.rb
+1
-1
ee/lib/gitlab/com.rb
ee/lib/gitlab/com.rb
+1
-1
ee/spec/controllers/registrations/groups_controller_spec.rb
ee/spec/controllers/registrations/groups_controller_spec.rb
+3
-3
ee/spec/controllers/registrations/groups_projects_controller_spec.rb
...trollers/registrations/groups_projects_controller_spec.rb
+7
-7
ee/spec/controllers/registrations/projects_controller_spec.rb
...pec/controllers/registrations/projects_controller_spec.rb
+3
-3
ee/spec/controllers/registrations/verification_controller_spec.rb
...controllers/registrations/verification_controller_spec.rb
+3
-3
ee/spec/controllers/trial_registrations_controller_spec.rb
ee/spec/controllers/trial_registrations_controller_spec.rb
+3
-3
ee/spec/controllers/trials_controller_spec.rb
ee/spec/controllers/trials_controller_spec.rb
+5
-5
ee/spec/features/google_analytics_datalayer_spec.rb
ee/spec/features/google_analytics_datalayer_spec.rb
+1
-1
ee/spec/features/invites_spec.rb
ee/spec/features/invites_spec.rb
+3
-3
ee/spec/features/registrations/one_trust_spec.rb
ee/spec/features/registrations/one_trust_spec.rb
+1
-1
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
+1
-1
ee/spec/helpers/ee/ci/runners_helper_spec.rb
ee/spec/helpers/ee/ci/runners_helper_spec.rb
+5
-5
ee/spec/helpers/ee/trial_registration_helper_spec.rb
ee/spec/helpers/ee/trial_registration_helper_spec.rb
+1
-1
ee/spec/helpers/ee/users/callouts_helper_spec.rb
ee/spec/helpers/ee/users/callouts_helper_spec.rb
+2
-2
ee/spec/lib/ee/gitlab/gon_helper_spec.rb
ee/spec/lib/ee/gitlab/gon_helper_spec.rb
+1
-1
ee/spec/models/ee/user_spec.rb
ee/spec/models/ee/user_spec.rb
+2
-2
ee/spec/models/gitlab_subscription_spec.rb
ee/spec/models/gitlab_subscription_spec.rb
+5
-5
ee/spec/requests/projects/pipelines/email_campaigns_controller_spec.rb
...sts/projects/pipelines/email_campaigns_controller_spec.rb
+3
-3
ee/spec/requests/survey_responses_controller_spec.rb
ee/spec/requests/survey_responses_controller_spec.rb
+1
-1
ee/spec/services/ee/notification_service_spec.rb
ee/spec/services/ee/notification_service_spec.rb
+2
-2
ee/spec/support/shared_examples/controllers/registrations/groups_controller_shared_examples.rb
...ollers/registrations/groups_controller_shared_examples.rb
+3
-3
ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb
...lers/registrations/projects_controller_shared_examples.rb
+3
-3
ee/spec/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker_spec.rb
...ed_namespace_subscriptions_from_index_cron_worker_spec.rb
+3
-3
No files found.
ee/app/controllers/ee/application_controller.rb
View file @
202d0774
...
...
@@ -12,7 +12,7 @@ module EE
end
def
check_if_gl_com_or_dev
render_404
unless
::
Gitlab
.
dev_env_or_
com?
render_404
unless
::
Gitlab
.
com?
end
def
verify_namespace_plan_check_enabled
...
...
ee/app/controllers/ee/registrations/welcome_controller.rb
View file @
202d0774
...
...
@@ -52,7 +52,7 @@ module EE
def
update_params
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'
...
...
ee/app/controllers/survey_responses_controller.rb
View file @
202d0774
...
...
@@ -19,7 +19,7 @@ class SurveyResponsesController < ApplicationController
private
def
track_response
return
unless
Gitlab
.
dev_env_or_
com?
return
unless
Gitlab
.
com?
data
=
{
survey_id:
to_number
(
params
[
:survey_id
]),
...
...
@@ -42,7 +42,7 @@ class SurveyResponsesController < ApplicationController
end
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
Feature
.
enabled?
(
:calendly_invite_link
)
...
...
ee/app/helpers/ee/ci/pipelines_helper.rb
View file @
202d0774
...
...
@@ -4,7 +4,7 @@ module EE
module
Ci
module
PipelinesHelper
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
pipeline
.
user_not_verified?
&&
!
pipeline
.
user
.
has_required_credit_card_to_run_pipelines?
(
pipeline
.
project
)
...
...
ee/app/helpers/ee/ci/runners_helper.rb
View file @
202d0774
...
...
@@ -17,20 +17,20 @@ module EE
end
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
)
end
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?
show_out_of_pipeline_minutes_notification?
(
project
,
namespace
)
end
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?
show_out_of_pipeline_minutes_notification?
(
project
,
namespace
)
...
...
ee/app/helpers/ee/trial_registration_helper.rb
View file @
202d0774
...
...
@@ -3,7 +3,7 @@
module
EE
module
TrialRegistrationHelper
def
social_signin_enabled?
::
Gitlab
.
dev_env_or_
com?
&&
::
Gitlab
.
com?
&&
omniauth_enabled?
&&
devise_mapping
.
omniauthable?
&&
button_based_providers_enabled?
...
...
ee/app/helpers/ee/users/callouts_helper.rb
View file @
202d0774
...
...
@@ -104,7 +104,7 @@ module EE
end
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
current_user
return
false
if
current_user
.
has_valid_credit_card?
...
...
ee/app/helpers/ee/welcome_helper.rb
View file @
202d0774
...
...
@@ -69,7 +69,7 @@ module EE
end
def
signup_onboarding_enabled?
::
Gitlab
.
dev_env_or_
com?
::
Gitlab
.
com?
end
end
end
ee/app/helpers/seats_count_alert_helper.rb
View file @
202d0774
...
...
@@ -26,7 +26,7 @@ module SeatsCountAlertHelper
end
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?
!!
@display_seats_count_alert
...
...
ee/app/models/ee/user.rb
View file @
202d0774
...
...
@@ -455,7 +455,7 @@ module EE
end
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
)
root_namespace
=
project
.
root_namespace
...
...
ee/app/models/gitlab_subscription.rb
View file @
202d0774
...
...
@@ -160,7 +160,7 @@ class GitlabSubscription < ApplicationRecord
end
def
automatically_index_in_elasticsearch?
return
false
unless
::
Gitlab
.
dev_env_or_
com?
return
false
unless
::
Gitlab
.
com?
return
false
if
expired?
# We only index paid groups on dot com for now.
...
...
ee/app/services/ee/notification_service.rb
View file @
202d0774
...
...
@@ -194,7 +194,7 @@ module EE
def
send_account_validation_email
(
pipeline
)
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
.
user_not_verified?
...
...
ee/app/views/admin/application_settings/_slack.html.haml
View file @
202d0774
-
return
unless
Gitlab
.
dev_env_or_
com?
-
return
unless
Gitlab
.
com?
-
expanded
=
integration_expanded?
(
'slack_app_'
)
%section
.settings.as-slack.no-animate
#js-slack-settings
{
class:
(
'expanded'
if
expanded
)
}
...
...
ee/app/views/namespaces/pipelines_quota/_list.haml
View file @
202d0774
...
...
@@ -7,7 +7,7 @@
.pipeline-quota.container-fluid
.row
.col-sm-6.offset-sm-6
-
if
::
Gitlab
.
dev_env_or_
com?
-
if
::
Gitlab
.
com?
=
link_to
s_
(
'UsageQuota|Buy additional minutes'
),
buy_additional_minutes_path
(
namespace
),
target:
buy_addon_target_attr
(
namespace
),
...
...
ee/app/views/registrations/welcome/_joining_project.html.haml
View file @
202d0774
-
return
unless
Gitlab
.
dev_env_or_
com?
-
return
unless
Gitlab
.
com?
-
return
if
in_trial_flow?
-
experiment
(
:bypass_registration
,
user:
current_user
)
do
|
e
|
...
...
ee/app/views/registrations/welcome/_setup_for_company.html.haml
View file @
202d0774
-
return
unless
Gitlab
.
dev_env_or_
com?
-
return
unless
Gitlab
.
com?
-
if
user_has_memberships?
=
f
.
hidden_field
:setup_for_company
,
value:
true
...
...
ee/app/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker.rb
View file @
202d0774
...
...
@@ -12,7 +12,7 @@ class ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker
idempotent!
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
GitlabSubscription
.
yield_long_expired_indexed_namespaces
do
|
indexed_namespace
|
...
...
ee/lib/ee/gitlab/gon_helper.rb
View file @
202d0774
...
...
@@ -11,7 +11,7 @@ module EE
gon
.
roadmap_epics_limit
=
1000
if
::
Gitlab
.
dev_env_or_
com?
if
::
Gitlab
.
com?
gon
.
subscriptions_url
=
::
Gitlab
::
SubscriptionPortal
::
SUBSCRIPTIONS_URL
gon
.
payment_form_url
=
::
Gitlab
::
SubscriptionPortal
::
PAYMENT_FORM_URL
gon
.
registration_validation_form_url
=
::
Gitlab
::
SubscriptionPortal
::
REGISTRATION_VALIDATION_FORM_URL
...
...
ee/lib/gitlab/com.rb
View file @
202d0774
...
...
@@ -14,7 +14,7 @@ module Gitlab
def
self
.
gitlab_com_group_member?
(
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
# rubocop: disable CodeReuse/ActiveRecord
...
...
ee/spec/controllers/registrations/groups_controller_spec.rb
View file @
202d0774
...
...
@@ -13,7 +13,7 @@ RSpec.describe Registrations::GroupsController do
let_it_be
(
:trial_form_params
)
{
{
trial:
'false'
}
}
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
(
:setup_for_company
)
{
nil
}
let
(
:params
)
do
...
...
@@ -30,7 +30,7 @@ RSpec.describe Registrations::GroupsController do
context
'with an authenticated user'
do
before
do
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
context
'when on .com'
do
...
...
@@ -235,7 +235,7 @@ RSpec.describe Registrations::GroupsController do
end
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
)
}
end
...
...
ee/spec/controllers/registrations/groups_projects_controller_spec.rb
View file @
202d0774
...
...
@@ -15,7 +15,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
subject
{
get
:new
}
before
do
allow
(
::
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
sign_in
(
user
)
end
...
...
@@ -64,7 +64,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
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
(
: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
(
:combined_registration?
)
{
true
}
...
...
@@ -76,7 +76,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context
'with an authenticated user'
do
before
do
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
it_behaves_like
'hides email confirmation warning'
...
...
@@ -155,7 +155,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
end
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
)
}
end
...
...
@@ -339,7 +339,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
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
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
context
'with an unauthenticated user'
do
it
{
is_expected
.
to
have_gitlab_http_status
(
:redirect
)
}
...
...
@@ -349,7 +349,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context
'with an authenticated user'
do
before
do
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
it_behaves_like
'hides email confirmation warning'
...
...
@@ -421,7 +421,7 @@ RSpec.describe Registrations::GroupsProjectsController, :experiment do
context
'with an authenticated user'
do
before
do
sign_in
(
user
)
allow
(
::
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:redirect
)
}
...
...
ee/spec/controllers/registrations/projects_controller_spec.rb
View file @
202d0774
...
...
@@ -16,11 +16,11 @@ RSpec.describe Registrations::ProjectsController do
end
context
'with an authenticated user'
do
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
before
do
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
context
'when on .com'
do
...
...
@@ -43,7 +43,7 @@ RSpec.describe Registrations::ProjectsController do
end
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
)
}
end
...
...
ee/spec/controllers/registrations/verification_controller_spec.rb
View file @
202d0774
...
...
@@ -14,11 +14,11 @@ RSpec.describe Registrations::VerificationController do
end
context
'with an authenticated user'
do
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
before
do
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
context
'when on .com'
do
...
...
@@ -36,7 +36,7 @@ RSpec.describe Registrations::VerificationController do
end
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
)
}
end
...
...
ee/spec/controllers/trial_registrations_controller_spec.rb
View file @
202d0774
...
...
@@ -3,17 +3,17 @@
require
'spec_helper'
RSpec
.
describe
TrialRegistrationsController
do
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
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
shared_examples
'a dot-com only feature'
do
let
(
:success_status
)
{
:ok
}
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
)
}
end
...
...
ee/spec/controllers/trials_controller_spec.rb
View file @
202d0774
...
...
@@ -5,11 +5,9 @@ require 'spec_helper'
RSpec
.
describe
TrialsController
,
:saas
do
let_it_be
(
:user
)
{
create
(
:user
,
email_opted_in:
true
,
last_name:
'Doe'
)
}
let
(
:dev_env_or_com
)
{
true
}
let
(
:logged_in
)
{
true
}
before
do
allow
(
::
Gitlab
).
to
receive
(
:dev_env_or_com?
).
and_return
(
dev_env_or_com
)
sign_in
(
user
)
if
logged_in
end
...
...
@@ -30,13 +28,15 @@ RSpec.describe TrialsController, :saas do
shared_examples
'a dot-com only feature'
do
let
(
:success_status
)
{
:ok
}
context
'when not on gitlab.com and not in development environment'
do
let
(
:dev_env_or_com
)
{
false
}
context
'when not on gitlab.com '
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:not_found
)
}
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
)
}
end
end
...
...
ee/spec/features/google_analytics_datalayer_spec.rb
View file @
202d0774
...
...
@@ -10,7 +10,7 @@ RSpec.describe 'GitLab.com Google Analytics DataLayer', :js do
let_it_be
(
:group
)
{
create
(
:group
)
}
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_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
})
...
...
ee/spec/features/invites_spec.rb
View file @
202d0774
...
...
@@ -7,11 +7,11 @@ RSpec.describe 'Group or Project invitations' do
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
group
)
}
let
(
:group_invite
)
{
create
(
:group_member
,
:invited
,
group:
group
)
}
let
(
:new_user
)
{
build_stubbed
(
:user
,
email:
group_invite
.
invite_email
)
}
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
before
do
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
)
end
...
...
@@ -47,7 +47,7 @@ RSpec.describe 'Group or Project invitations' do
end
context
'when not on .com'
do
let
(
:
dev_env_or_
com
)
{
false
}
let
(
:com
)
{
false
}
it
'bypasses the setup_for_company question'
do
fill_in_sign_up_form
(
new_user
)
...
...
ee/spec/features/registrations/one_trust_spec.rb
View file @
202d0774
...
...
@@ -11,7 +11,7 @@ RSpec.describe 'OneTrust in the sign up flow' do
before
do
stub_config
(
extra:
{
one_trust_id:
one_trust_id
})
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
)
end
...
...
ee/spec/helpers/ee/ci/pipelines_helper_spec.rb
View file @
202d0774
...
...
@@ -45,7 +45,7 @@ RSpec.describe EE::Ci::PipelinesHelper do
let
(
:pipeline
)
{
instance_double
(
Ci
::
Pipeline
)
}
before
do
allow
(
Gitlab
).
to
receive
(
:
dev_env_or_
com?
)
{
false
}
allow
(
Gitlab
).
to
receive
(
:com?
)
{
false
}
end
it
{
is_expected
.
to
be_falsy
}
...
...
ee/spec/helpers/ee/ci/runners_helper_spec.rb
View file @
202d0774
...
...
@@ -22,7 +22,7 @@ RSpec.describe EE::Ci::RunnersHelper do
context
'with a project and namespace'
do
context
'when not on dot com'
do
let
(
:
dev_env_or_
com
)
{
false
}
let
(
:com
)
{
false
}
it
{
is_expected
.
to
be_falsey
}
end
...
...
@@ -106,7 +106,7 @@ RSpec.describe EE::Ci::RunnersHelper do
end
context
'with notifications'
do
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
describe
'.show_buy_pipeline_minutes?'
do
subject
{
helper
.
show_buy_pipeline_minutes?
(
project
,
namespace
)
}
...
...
@@ -114,7 +114,7 @@ RSpec.describe EE::Ci::RunnersHelper do
context
'when on dot com'
do
it_behaves_like
'minutes notification'
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
...
...
@@ -124,7 +124,7 @@ RSpec.describe EE::Ci::RunnersHelper do
subject
{
helper
.
show_pipeline_minutes_notification_dot?
(
project
,
namespace
)
}
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
it_behaves_like
'minutes notification'
...
...
@@ -151,7 +151,7 @@ RSpec.describe EE::Ci::RunnersHelper do
subject
{
helper
.
show_buy_pipeline_with_subtext?
(
project
,
namespace
)
}
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
context
'when the notification dot has not been acknowledged'
do
...
...
ee/spec/helpers/ee/trial_registration_helper_spec.rb
View file @
202d0774
...
...
@@ -7,7 +7,7 @@ RSpec.describe EE::TrialRegistrationHelper do
describe
'#social_signin_enabled?'
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
(
:button_based_providers_enabled?
).
and_return
(
button_based_providers_enabled
)
allow
(
view
).
to
receive
(
:devise_mapping
).
and_return
(
double
(
omniauthable?:
omniauthable
))
...
...
ee/spec/helpers/ee/users/callouts_helper_spec.rb
View file @
202d0774
...
...
@@ -431,7 +431,7 @@ RSpec.describe EE::Users::CalloutsHelper do
with_them
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
(
user
).
to
receive
(
:has_valid_credit_card?
).
and_return
(
!
unverified?
)
pipeline
.
update!
(
failure_reason:
nil
)
unless
failed_pipeline?
...
...
@@ -444,7 +444,7 @@ RSpec.describe EE::Users::CalloutsHelper do
describe
'dismissing the alert timing'
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
)
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
)
...
...
ee/spec/lib/ee/gitlab/gon_helper_spec.rb
View file @
202d0774
...
...
@@ -28,7 +28,7 @@ RSpec.describe EE::Gitlab::GonHelper do
context
'when GitLab.com'
do
before
do
allow
(
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
true
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it
'includes CustomersDot variables'
do
...
...
ee/spec/models/ee/user_spec.rb
View file @
202d0774
...
...
@@ -1751,7 +1751,7 @@ RSpec.describe User do
with_them
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
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
)
...
...
@@ -1805,7 +1805,7 @@ RSpec.describe User do
with_them
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
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
)
...
...
ee/spec/models/gitlab_subscription_spec.rb
View file @
202d0774
...
...
@@ -367,12 +367,10 @@ RSpec.describe GitlabSubscription, :saas do
let_it_be
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:gitlab_subscription
)
{
build
(
:gitlab_subscription
,
plan
,
namespace:
namespace
)
}
let
(
:dev_env_or_com
)
{
true
}
let
(
:expiration_date
)
{
Date
.
today
+
10
}
let
(
:plan
)
{
:bronze
}
before
do
allow
(
::
Gitlab
).
to
receive
(
:dev_env_or_com?
).
and_return
(
dev_env_or_com
)
gitlab_subscription
.
end_date
=
expiration_date
end
...
...
@@ -423,8 +421,10 @@ RSpec.describe GitlabSubscription, :saas do
end
end
context
'when not ::Gitlab.dev_env_or_com?'
do
let
(
:dev_env_or_com
)
{
false
}
context
'when not ::Gitlab.com?'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it
'does not index the namespace'
do
expect
(
ElasticsearchIndexedNamespace
).
not_to
receive
(
:safe_find_or_create_by!
)
...
...
@@ -579,7 +579,7 @@ RSpec.describe GitlabSubscription, :saas do
let_it_be
(
:expired_subscription2
)
{
create
(
:gitlab_subscription
,
:bronze
,
end_date:
Date
.
today
-
40
)
}
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_subscription2
.
namespace_id
)
ElasticsearchIndexedNamespace
.
safe_find_or_create_by!
(
namespace_id:
recently_expired_subscription
.
namespace_id
)
...
...
ee/spec/requests/projects/pipelines/email_campaigns_controller_spec.rb
View file @
202d0774
...
...
@@ -5,14 +5,14 @@ require 'spec_helper'
RSpec
.
describe
Projects
::
Pipelines
::
EmailCampaignsController
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
subject
(
:request
)
do
get
project_pipeline_validate_account_path
(
project
,
pipeline
)
end
before
do
allow
(
Gitlab
).
to
receive
(
:
dev_env_or_com?
)
{
dev_env_or_
com
}
allow
(
Gitlab
).
to
receive
(
:
com?
)
{
com
}
end
describe
'GET #validate_account'
,
:snowplow
do
...
...
@@ -49,7 +49,7 @@ RSpec.describe Projects::Pipelines::EmailCampaignsController do
end
context
'when not in .com or dev env'
do
let
(
:
dev_env_or_
com
)
{
false
}
let
(
:com
)
{
false
}
it
'returns 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
...
...
ee/spec/requests/survey_responses_controller_spec.rb
View file @
202d0774
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
SurveyResponsesController
do
describe
'GET #index'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
ondotcom
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
ondotcom
)
end
subject
(
:request
)
{
get
survey_responses_path
(
params
)
}
...
...
ee/spec/services/ee/notification_service_spec.rb
View file @
202d0774
...
...
@@ -1009,7 +1009,7 @@ RSpec.describe EE::NotificationService, :mailer do
subject
(
:pipeline_finished
)
{
NotificationService
.
new
.
pipeline_finished
(
pipeline
)
}
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
)
project
.
add_maintainer
(
user
)
...
...
@@ -1040,7 +1040,7 @@ RSpec.describe EE::NotificationService, :mailer do
context
'when not in dev env or gitlab.com'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
false
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
include_examples
'does not send account activation email'
...
...
ee/spec/support/shared_examples/controllers/registrations/groups_controller_shared_examples.rb
View file @
202d0774
...
...
@@ -24,7 +24,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
subject
{
get
:new
}
...
...
@@ -36,7 +36,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
context
'with an authenticated user'
do
before
do
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
context
'when on .com'
do
...
...
@@ -64,7 +64,7 @@ RSpec.shared_examples "Registrations::GroupsController GET #new" do
end
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
)
}
end
...
...
ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb
View file @
202d0774
...
...
@@ -9,7 +9,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
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
(
:
dev_env_or_
com
)
{
true
}
let
(
:com
)
{
true
}
let
(
:extra_params
)
{
{}
}
let
(
:success_path
)
{
nil
}
let
(
:stored_location_for
)
{
nil
}
...
...
@@ -23,7 +23,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
before
do
namespace
.
add_owner
(
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
end
...
...
@@ -132,7 +132,7 @@ RSpec.shared_examples "Registrations::ProjectsController POST #create" do
end
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
)
}
end
...
...
ee/spec/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker_spec.rb
View file @
202d0774
...
...
@@ -12,7 +12,7 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s
let
(
:expired_subscription2
)
{
create
(
:gitlab_subscription
,
:bronze
,
end_date:
Date
.
today
-
35
)
}
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_subscription2
.
namespace_id
)
ElasticsearchIndexedNamespace
.
safe_find_or_create_by!
(
namespace_id:
recently_expired_subscription
.
namespace_id
)
...
...
@@ -35,9 +35,9 @@ RSpec.describe ElasticRemoveExpiredNamespaceSubscriptionsFromIndexCronWorker, :s
end
end
context
'when not
dev_env_or_
com?'
do
context
'when not com?'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:
dev_env_or_
com?
).
and_return
(
false
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it
'does nothing'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment