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
4d433c20
Commit
4d433c20
authored
Jan 07, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cheap calls first
parent
0275c26e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
41 deletions
+32
-41
ee/app/helpers/ee/user_callouts_helper.rb
ee/app/helpers/ee/user_callouts_helper.rb
+3
-3
ee/spec/helpers/ee/user_callouts_helper_spec.rb
ee/spec/helpers/ee/user_callouts_helper_spec.rb
+29
-38
No files found.
ee/app/helpers/ee/user_callouts_helper.rb
View file @
4d433c20
...
...
@@ -42,14 +42,14 @@ module EE
end
def
show_enable_hashed_storage_warning?
return
if
user_dismissed?
(
GEO_ENABLE_HASHED_STORAGE
)
return
if
hashed_storage_enabled?
!
hashed_storage_enabled?
!
user_dismissed?
(
GEO_ENABLE_HASHED_STORAGE
)
end
def
show_migrate_hashed_storage_warning?
return
if
user_dismissed?
(
GEO_MIGRATE_HASHED_STORAGE
)
return
unless
hashed_storage_enabled?
return
if
user_dismissed?
(
GEO_MIGRATE_HASHED_STORAGE
)
any_project_not_in_hashed_storage?
end
...
...
ee/spec/helpers/ee/user_callouts_helper_spec.rb
View file @
4d433c20
...
...
@@ -79,36 +79,31 @@ describe EE::UserCalloutsHelper do
subject
{
helper
.
show_enable_hashed_storage_warning?
}
let
(
:user
)
{
create
(
:user
)
}
before
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'when the enable warning has not been dismissed'
do
context
'when hashed storage is disabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
false
)
end
context
'when hashed storage is disabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
false
)
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'when the enable warning has not been dismissed'
do
it
{
is_expected
.
to
be_truthy
}
end
context
'when
hashed storage is enabl
ed'
do
context
'when
the enable warning was dismiss
ed'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABLE_HASHED_STORAGE
)
end
it
{
is_expected
.
to
be_falsy
}
end
end
context
'when the enable warning was dismissed'
do
it
'does not render the enable warning'
do
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABLE_HASHED_STORAGE
)
expect
(
helper
).
not_to
receive
(
:render_flash_user_callout
)
helper
.
render_enable_hashed_storage_warning
context
'when hashed storage is enabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
end
it
{
is_expected
.
to
be_falsy
}
end
end
...
...
@@ -116,24 +111,21 @@ describe EE::UserCalloutsHelper do
subject
{
helper
.
show_migrate_hashed_storage_warning?
}
let
(
:user
)
{
create
(
:user
)
}
before
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'when hashed storage is disabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
false
)
end
context
'when the migrate warning has not been dismissed'
do
context
'when hashed storage is disabled'
do
before
do
expect
(
helper
).
to
receive
(
:hashed_storage_enabled?
).
and_return
(
false
)
end
it
{
is_expected
.
to
be_falsy
}
end
it
{
is_expected
.
to
be_falsy
}
context
'when hashed storage is enabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'when hashed storage is enabled'
do
before
do
expect
(
helper
).
to
receive
(
:hashed_storage_enabled?
).
and_return
(
true
)
end
context
'when the enable warning has not been dismissed'
do
context
'when there is a project in non-hashed-storage'
do
before
do
create
(
:project
,
:legacy_storage
)
...
...
@@ -146,14 +138,13 @@ describe EE::UserCalloutsHelper do
it
{
is_expected
.
to
be_falsy
}
end
end
end
context
'when the migrat
e warning was dismissed'
do
it
'does not render the migrate warning'
do
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABL
E_HASHED_STORAGE
)
e
xpect
(
helper
).
not_to
receive
(
:render_flash_user_callout
)
context
'when the enabl
e warning was dismissed'
do
before
do
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_MIGRAT
E_HASHED_STORAGE
)
e
nd
helper
.
render_migrate_hashed_storage_warning
it
{
is_expected
.
to
be_falsy
}
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