Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
85092129
Commit
85092129
authored
13 years ago
by
Gregor Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
[
#373
] Adding test and fix for duplicates in issue autocompleter
parent
7cd96b6a
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/auto_completes_controller.rb
+1
-0
1 addition, 0 deletions
app/controllers/auto_completes_controller.rb
test/functional/auto_completes_controller_test.rb
+7
-7
7 additions, 7 deletions
test/functional/auto_completes_controller_test.rb
with
8 additions
and
7 deletions
app/controllers/auto_completes_controller.rb
+
1
−
0
View file @
85092129
...
...
@@ -15,6 +15,7 @@ class AutoCompletesController < ApplicationController
:conditions
=>
[
"LOWER(
#{
Issue
.
table_name
}
.subject) LIKE :q OR CAST(
#{
Issue
.
table_name
}
.id AS CHAR(13)) LIKE :q"
,
{
:q
=>
"%
#{
q
.
downcase
}
%"
}])
end
@issues
.
compact!
@issues
.
uniq!
render
:layout
=>
false
end
...
...
This diff is collapsed.
Click to expand it.
test/functional/auto_completes_controller_test.rb
+
7
−
7
View file @
85092129
...
...
@@ -20,19 +20,19 @@ class AutoCompletesControllerTest < ActionController::TestCase
test
'should return issues matching a given id'
do
@project
=
Project
.
find
(
'subproject1'
)
@issue_21
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
21
)
@issue_101
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
101
)
@issue_102
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
102
)
@issue_with_subject
=
Issue
.
generate_for_project!
(
@project
,
:subject
=>
'This has 1 in the subject'
)
@issue_
2
101
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
2
101
)
@issue_
2
102
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
2
102
)
@issue_with_subject
=
Issue
.
generate_for_project!
(
@project
,
:subject
=>
'This has
2
1 in the subject'
)
get
:issues
,
:project_id
=>
@project
.
id
,
:q
=>
'1'
get
:issues
,
:project_id
=>
@project
.
id
,
:q
=>
'
2
1'
assert_response
:success
assert_not_nil
assigns
(
:issues
)
assert
assigns
(
:issues
).
include?
(
Issue
.
find
(
13
))
assert
assigns
(
:issues
).
include?
(
@issue_21
)
assert
assigns
(
:issues
).
include?
(
@issue_101
)
assert
assigns
(
:issues
).
include?
(
@issue_102
)
assert
assigns
(
:issues
).
include?
(
@issue_
2
101
)
assert
assigns
(
:issues
).
include?
(
@issue_
2
102
)
assert
assigns
(
:issues
).
include?
(
@issue_with_subject
)
assert_equal
assigns
(
:issues
).
size
,
assigns
(
:issues
).
uniq
.
size
,
"Issues list includes duplicates"
end
def
test_auto_complete_with_scope_all_and_cross_project_relations
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment