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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
26b9d8fe
Commit
26b9d8fe
authored
Nov 07, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper tests
parent
91d88d10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+1
-1
spec/helpers/search_helper_spec.rb
spec/helpers/search_helper_spec.rb
+35
-0
No files found.
app/helpers/search_helper.rb
View file @
26b9d8fe
...
@@ -179,7 +179,7 @@ module SearchHelper
...
@@ -179,7 +179,7 @@ module SearchHelper
elsif
@group
.
present?
elsif
@group
.
present?
@group
.
full_path
@group
.
full_path
else
else
root_dashboard_path
'dashboard'
end
end
end
end
...
...
spec/helpers/search_helper_spec.rb
View file @
26b9d8fe
...
@@ -135,5 +135,40 @@ describe SearchHelper do
...
@@ -135,5 +135,40 @@ describe SearchHelper do
expect
(
search_filter_input_options
(
''
)[
:data
][
'base-endpoint'
]).
to
eq
(
"/groups
#{
group_path
(
@group
)
}
"
)
expect
(
search_filter_input_options
(
''
)[
:data
][
'base-endpoint'
]).
to
eq
(
"/groups
#{
group_path
(
@group
)
}
"
)
end
end
end
end
context
'dashboard'
do
it
'does not include group-id and project-id'
do
expect
(
search_filter_input_options
(
''
)[
:data
][
'project-id'
]).
to
eq
(
nil
)
expect
(
search_filter_input_options
(
''
)[
:data
][
'group-id'
]).
to
eq
(
nil
)
end
it
'includes dashboard base-endpoint'
do
expect
(
search_filter_input_options
(
''
)[
:data
][
'base-endpoint'
]).
to
eq
(
"/dashboard"
)
end
end
end
describe
'search_history_storage_prefix'
do
context
'project'
do
it
'returns project full_path'
do
@project
=
create
(
:project
,
:repository
)
expect
(
search_history_storage_prefix
).
to
eq
(
@project
.
full_path
)
end
end
context
'group'
do
it
'returns group full_path'
do
@group
=
create
(
:group
,
:nested
,
name:
'group-name'
)
expect
(
search_history_storage_prefix
).
to
eq
(
@group
.
full_path
)
end
end
context
'dashboard'
do
it
'returns dashboard'
do
expect
(
search_history_storage_prefix
).
to
eq
(
"dashboard"
)
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