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
...
@@ -42,14 +42,14 @@ module EE
end
end
def
show_enable_hashed_storage_warning?
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
end
def
show_migrate_hashed_storage_warning?
def
show_migrate_hashed_storage_warning?
return
if
user_dismissed?
(
GEO_MIGRATE_HASHED_STORAGE
)
return
unless
hashed_storage_enabled?
return
unless
hashed_storage_enabled?
return
if
user_dismissed?
(
GEO_MIGRATE_HASHED_STORAGE
)
any_project_not_in_hashed_storage?
any_project_not_in_hashed_storage?
end
end
...
...
ee/spec/helpers/ee/user_callouts_helper_spec.rb
View file @
4d433c20
...
@@ -79,36 +79,31 @@ describe EE::UserCalloutsHelper do
...
@@ -79,36 +79,31 @@ describe EE::UserCalloutsHelper do
subject
{
helper
.
show_enable_hashed_storage_warning?
}
subject
{
helper
.
show_enable_hashed_storage_warning?
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
context
'when hashed storage is disabled'
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
before
do
end
stub_application_setting
(
hashed_storage_enabled:
false
)
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
context
'when the enable warning has not been dismissed'
do
end
context
'when hashed storage is disabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
false
)
end
context
'when the enable warning has not been dismissed'
do
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
end
end
context
'when
hashed storage is enabl
ed'
do
context
'when
the enable warning was dismiss
ed'
do
before
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABLE_HASHED_STORAGE
)
end
end
it
{
is_expected
.
to
be_falsy
}
it
{
is_expected
.
to
be_falsy
}
end
end
end
end
context
'when the enable warning was dismissed'
do
context
'when hashed storage is enabled'
do
it
'does not render the enable warning'
do
before
do
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABLE_HASHED_STORAGE
)
stub_application_setting
(
hashed_storage_enabled:
true
)
expect
(
helper
).
not_to
receive
(
:render_flash_user_callout
)
helper
.
render_enable_hashed_storage_warning
end
end
it
{
is_expected
.
to
be_falsy
}
end
end
end
end
...
@@ -116,24 +111,21 @@ describe EE::UserCalloutsHelper do
...
@@ -116,24 +111,21 @@ describe EE::UserCalloutsHelper do
subject
{
helper
.
show_migrate_hashed_storage_warning?
}
subject
{
helper
.
show_migrate_hashed_storage_warning?
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
context
'when hashed storage is disabled'
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
before
do
end
stub_application_setting
(
hashed_storage_enabled:
false
)
end
context
'when the migrate warning has not been dismissed'
do
it
{
is_expected
.
to
be_falsy
}
context
'when hashed storage is disabled'
do
end
before
do
expect
(
helper
).
to
receive
(
:hashed_storage_enabled?
).
and_return
(
false
)
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
end
context
'when hashed storage is enabled'
do
context
'when the enable warning has not been dismissed'
do
before
do
expect
(
helper
).
to
receive
(
:hashed_storage_enabled?
).
and_return
(
true
)
end
context
'when there is a project in non-hashed-storage'
do
context
'when there is a project in non-hashed-storage'
do
before
do
before
do
create
(
:project
,
:legacy_storage
)
create
(
:project
,
:legacy_storage
)
...
@@ -146,14 +138,13 @@ describe EE::UserCalloutsHelper do
...
@@ -146,14 +138,13 @@ describe EE::UserCalloutsHelper do
it
{
is_expected
.
to
be_falsy
}
it
{
is_expected
.
to
be_falsy
}
end
end
end
end
end
context
'when the migrat
e warning was dismissed'
do
context
'when the enabl
e warning was dismissed'
do
it
'does not render the migrate warning'
do
before
do
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_ENABL
E_HASHED_STORAGE
)
create
(
:user_callout
,
user:
user
,
feature_name:
described_class
::
GEO_MIGRAT
E_HASHED_STORAGE
)
e
xpect
(
helper
).
not_to
receive
(
:render_flash_user_callout
)
e
nd
helper
.
render_migrate_hashed_storage_warning
it
{
is_expected
.
to
be_falsy
}
end
end
end
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