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
ca1e4fb3
Commit
ca1e4fb3
authored
Apr 14, 2021
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip experimentation on self-managed
For in product marketing emails
parent
0e81fa09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
16 deletions
+38
-16
app/services/namespaces/in_product_marketing_emails_service.rb
...ervices/namespaces/in_product_marketing_emails_service.rb
+5
-3
spec/services/namespaces/in_product_marketing_emails_service_spec.rb
...es/namespaces/in_product_marketing_emails_service_spec.rb
+33
-13
No files found.
app/services/namespaces/in_product_marketing_emails_service.rb
View file @
ca1e4fb3
...
...
@@ -41,9 +41,11 @@ module Namespaces
attr_reader
:track
,
:interval
,
:in_product_marketing_email_records
def
send_email_for_group
(
group
)
experiment_enabled_for_group
=
experiment_enabled_for_group?
(
group
)
experiment_add_group
(
group
,
experiment_enabled_for_group
)
return
unless
experiment_enabled_for_group
if
Gitlab
.
com?
experiment_enabled_for_group
=
experiment_enabled_for_group?
(
group
)
experiment_add_group
(
group
,
experiment_enabled_for_group
)
return
unless
experiment_enabled_for_group
end
users_for_group
(
group
).
each
do
|
user
|
if
can_perform_action?
(
user
,
group
)
...
...
spec/services/namespaces/in_product_marketing_emails_service_spec.rb
View file @
ca1e4fb3
...
...
@@ -85,26 +85,46 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
end
describe
'experimentation'
do
context
'when
the experiment is enabled
'
do
it
'adds the group as an experiment subject in the experimental group'
do
expect
(
Experiment
).
to
receive
(
:add_group
)
.
with
(
:in_product_marketing_emails
,
variant: :experimental
,
group:
group
)
context
'when
on dotcom
'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
execute_service
context
'when the experiment is enabled'
do
it
'adds the group as an experiment subject in the experimental group'
do
expect
(
Experiment
).
to
receive
(
:add_group
)
.
with
(
:in_product_marketing_emails
,
variant: :experimental
,
group:
group
)
execute_service
end
end
end
context
'when the experiment is disabled'
do
let
(
:experiment_enabled
)
{
false
}
context
'when the experiment is disabled'
do
let
(
:experiment_enabled
)
{
false
}
it
'adds the group as an experiment subject in the control group'
do
expect
(
Experiment
).
to
receive
(
:add_group
)
.
with
(
:in_product_marketing_emails
,
variant: :control
,
group:
group
)
it
'adds the group as an experiment subject in the control group'
do
expect
(
Experiment
).
to
receive
(
:add_group
)
.
with
(
:in_product_marketing_emails
,
variant: :control
,
group:
group
)
execute_service
end
execute_service
it
{
is_expected
.
not_to
send_in_product_marketing_email
}
end
it
{
is_expected
.
not_to
send_in_product_marketing_email
}
context
'when not on dotcom'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it
'does not add the group as an experiment subject'
do
expect
(
Experiment
).
not_to
receive
(
:add_group
)
execute_service
end
it
{
is_expected
.
to
send_in_product_marketing_email
(
user
.
id
,
group
.
id
,
:create
,
0
)
}
end
end
end
...
...
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