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
a8850202
Commit
a8850202
authored
Aug 02, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect trial user to feature for project security
parent
05476fef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
ee/app/controllers/trials_controller.rb
ee/app/controllers/trials_controller.rb
+1
-1
ee/spec/controllers/trials_controller_spec.rb
ee/spec/controllers/trials_controller_spec.rb
+17
-17
No files found.
ee/app/controllers/trials_controller.rb
View file @
a8850202
...
@@ -190,6 +190,6 @@ class TrialsController < ApplicationController
...
@@ -190,6 +190,6 @@ class TrialsController < ApplicationController
end
end
def
discover_group_security_flow?
def
discover_group_security_flow?
params
[
:glm_content
]
==
'discover-group-security'
%w(discover-group-security discover-project-security)
.
include?
(
params
[
:glm_content
])
end
end
end
end
ee/spec/controllers/trials_controller_spec.rb
View file @
a8850202
...
@@ -184,30 +184,30 @@ RSpec.describe TrialsController do
...
@@ -184,30 +184,30 @@ RSpec.describe TrialsController do
subject
subject
end
end
context
'
in discover group security flow
'
do
context
'
redirect trial user to feature
'
do
let
(
:post_params
)
{
{
namespace_id:
namespace
.
id
,
glm_content:
'discover-group-security'
}
}
using
RSpec
::
Parameterized
::
TableSyntax
context
'with redirect_trial_user_to_feature experiment variant'
do
where
(
:segment
,
:glm_content
,
:redirect
)
do
before
do
:control
|
'discover-group-security'
|
:group_url
stub_experiments
(
redirect_trial_user_to_feature: :candidate
)
:candidate
|
'discover-group-security'
|
:group_security_dashboard_url
:control
|
'discover-project-security'
|
:group_url
:candidate
|
'discover-project-security'
|
:group_security_dashboard_url
end
end
it
{
is_expected
.
to
redirect_to
(
group_security_dashboard_url
(
namespace
,
{
trial:
true
}))
}
with_them
do
it
'records the subject'
do
let
(
:post_params
)
{
{
namespace_id:
namespace
.
id
,
glm_content:
glm_content
}
}
expect
(
Experiment
).
to
receive
(
:add_subject
).
with
(
'redirect_trial_user_to_feature'
,
variant: :experimental
,
subject:
namespace
)
let
(
:variant
)
{
segment
==
:control
?
:control
:
:experimental
}
let
(
:redirect_url
)
do
subject
redirect
==
:group_url
?
group_url
(
namespace
,
{
trial:
true
})
:
group_security_dashboard_url
(
namespace
,
{
trial:
true
})
end
end
end
context
'with redirect_trial_user_to_feature experiment control'
do
before
do
before
do
stub_experiments
(
redirect_trial_user_to_feature:
:control
)
stub_experiments
(
redirect_trial_user_to_feature:
segment
)
end
end
it
{
is_expected
.
to
redirect_to
(
group_url
(
namespace
,
{
trial:
true
})
)
}
it
{
is_expected
.
to
redirect_to
(
redirect_url
)
}
it
'records the subject'
do
it
'records the subject'
do
expect
(
Experiment
).
to
receive
(
:add_subject
).
with
(
'redirect_trial_user_to_feature'
,
variant:
:control
,
subject:
namespace
)
expect
(
Experiment
).
to
receive
(
:add_subject
).
with
(
'redirect_trial_user_to_feature'
,
variant:
variant
,
subject:
namespace
)
subject
subject
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