Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
85092129
Commit
85092129
authored
May 04, 2011
by
Gregor Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#373
] Adding test and fix for duplicates in issue autocompleter
parent
7cd96b6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
auto_completes_controller.rb
app/controllers/auto_completes_controller.rb
+1
-0
auto_completes_controller_test.rb
test/functional/auto_completes_controller_test.rb
+7
-7
No files found.
app/controllers/auto_completes_controller.rb
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
...
...
test/functional/auto_completes_controller_test.rb
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_
2101
=
Issue
.
generate_for_project!
(
@project
,
:id
=>
2
101
)
@issue_
2102
=
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
...
...
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