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
8be435b0
Commit
8be435b0
authored
Dec 04, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show gold trial callout for readonly DB's
parent
e2eb1d8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
17 deletions
+51
-17
ee/app/helpers/ee/user_callouts_helper.rb
ee/app/helpers/ee/user_callouts_helper.rb
+2
-1
ee/spec/helpers/ee/user_callouts_helper_spec.rb
ee/spec/helpers/ee/user_callouts_helper_spec.rb
+43
-16
ee/spec/support/shared_examples/gold_trial_callout_shared_examples.rb
...ort/shared_examples/gold_trial_callout_shared_examples.rb
+6
-0
No files found.
ee/app/helpers/ee/user_callouts_helper.rb
View file @
8be435b0
...
...
@@ -12,7 +12,8 @@ module EE
end
def
show_gold_trial_suitable_env?
::
Gitlab
.
com?
||
Rails
.
env
.
development?
(
::
Gitlab
.
com?
||
Rails
.
env
.
development?
)
&&
!::
Gitlab
::
Database
.
read_only?
end
def
users_namespaces_clean?
(
user
)
...
...
ee/spec/helpers/ee/user_callouts_helper_spec.rb
View file @
8be435b0
...
...
@@ -64,32 +64,59 @@ describe EE::UserCalloutsHelper do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
gitlab_com
)
allow
(
Rails
.
env
).
to
receive
(
:development?
).
and_return
(
rails_dev_env
)
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
db_read_only
)
end
context
"when we're neither GitLab.com or a Rails development env"
do
let
(
:gitlab_com
)
{
false
}
let
(
:rails_dev_env
)
{
false
}
context
'with a writable DB'
do
let
(
:db_read_only
)
{
false
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_falsey
context
"when we're neither GitLab.com or a Rails development env"
do
let
(
:gitlab_com
)
{
false
}
let
(
:rails_dev_env
)
{
false
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_falsey
end
end
end
context
"when we're GitLab.com"
do
let
(
:gitlab_com
)
{
true
}
let
(
:rails_dev_env
)
{
false
}
context
"when we're GitLab.com"
do
let
(
:gitlab_com
)
{
true
}
let
(
:rails_dev_env
)
{
false
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_truthy
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_truthy
end
end
context
"when we're a Rails development env"
do
let
(
:gitlab_com
)
{
false
}
let
(
:rails_dev_env
)
{
true
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_truthy
end
end
end
context
"when we're a Rails development env"
do
let
(
:gitlab_com
)
{
false
}
let
(
:rails_dev_env
)
{
true
}
context
'with a readonly DB'
do
let
(
:db_read_only
)
{
true
}
context
"when we're GitLab.com"
do
let
(
:gitlab_com
)
{
true
}
let
(
:rails_dev_env
)
{
false
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_truthy
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_falsey
end
end
context
"when we're a Rails development env"
do
let
(
:gitlab_com
)
{
false
}
let
(
:rails_dev_env
)
{
true
}
it
'returns true'
do
expect
(
helper
.
show_gold_trial_suitable_env?
).
to
be_falsey
end
end
end
end
...
...
ee/spec/support/shared_examples/gold_trial_callout_shared_examples.rb
View file @
8be435b0
...
...
@@ -53,5 +53,11 @@ shared_examples 'gold trial callout' do
expect
(
page
).
not_to
have_selector
'.promotion-callout'
end
it
'hides promotion callout if database is in a readonly state'
do
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
expect
(
page
).
not_to
have_selector
'.promotion-callout'
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