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
ebc44bef
Commit
ebc44bef
authored
Nov 07, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken commits search
parent
6be0c160
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
2 deletions
+66
-2
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+1
-1
app/views/search/results/_commit.html.haml
app/views/search/results/_commit.html.haml
+1
-1
changelogs/unreleased/24255-search-fix.yml
changelogs/unreleased/24255-search-fix.yml
+4
-0
spec/features/global_search_spec.rb
spec/features/global_search_spec.rb
+28
-0
spec/features/search_spec.rb
spec/features/search_spec.rb
+26
-0
spec/spec_helper.rb
spec/spec_helper.rb
+1
-0
spec/support/search_helpers.rb
spec/support/search_helpers.rb
+5
-0
No files found.
app/controllers/search_controller.rb
View file @
ebc44bef
...
...
@@ -16,7 +16,7 @@ class SearchController < ApplicationController
@group
=
nil
unless
can?
(
current_user
,
:read_group
,
@group
)
end
return
if
params
[
:search
].
nil?
||
params
[
:search
].
blank?
return
if
params
[
:search
].
blank?
@search_term
=
params
[
:search
]
...
...
app/views/search/results/_commit.html.haml
View file @
ebc44bef
=
render
'projects/commits/commit'
,
project:
@project
,
commit:
commit
=
render
'projects/commits/commit'
,
project:
@project
,
commit:
commit
,
ref:
nil
changelogs/unreleased/24255-search-fix.yml
0 → 100644
View file @
ebc44bef
---
title
:
Fix broken commits search
merge_request
:
author
:
spec/features/global_search_spec.rb
0 → 100644
View file @
ebc44bef
require
'spec_helper'
feature
'Global search'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_with
(
user
)
end
describe
'I search through the issues and I see pagination'
do
before
do
allow_any_instance_of
(
Gitlab
::
SearchResults
).
to
receive
(
:per_page
).
and_return
(
1
)
create_list
(
:issue
,
2
,
project:
project
,
title:
'initial'
)
end
it
"has a pagination"
do
visit
dashboard_projects_path
fill_in
"search"
,
with:
"initial"
click_button
"Go"
select_filter
(
"Issues"
)
expect
(
page
).
to
have_selector
(
'.gl-pagination .page'
,
count:
2
)
end
end
end
spec/features/search_spec.rb
View file @
ebc44bef
...
...
@@ -100,6 +100,32 @@ describe "Search", feature: true do
expect
(
page
).
to
have_link
(
snippet
.
title
)
end
it
'finds a commit'
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
page
.
within
'.search'
do
fill_in
'search'
,
with:
'add'
click_button
'Go'
end
click_link
"Commits"
expect
(
page
).
to
have_selector
(
'.commit-row-description'
)
end
it
'finds a code'
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
page
.
within
'.search'
do
fill_in
'search'
,
with:
'def'
click_button
'Go'
end
click_link
"Code"
expect
(
page
).
to
have_selector
(
'.file-content .code'
)
end
end
describe
'Right header search field'
,
feature:
true
do
...
...
spec/spec_helper.rb
View file @
ebc44bef
...
...
@@ -29,6 +29,7 @@ RSpec.configure do |config|
config
.
include
Devise
::
Test
::
ControllerHelpers
,
type: :controller
config
.
include
Warden
::
Test
::
Helpers
,
type: :request
config
.
include
LoginHelpers
,
type: :feature
config
.
include
SearchHelpers
,
type: :feature
config
.
include
StubConfiguration
config
.
include
EmailHelpers
config
.
include
TestEnv
...
...
spec/support/search_helpers.rb
0 → 100644
View file @
ebc44bef
module
SearchHelpers
def
select_filter
(
name
)
find
(
:xpath
,
"//ul[contains(@class, 'search-filter')]//a[contains(.,'
#{
name
}
')]"
).
click
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