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
feae9d3a
Commit
feae9d3a
authored
May 29, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around allow_any_instance_of/and_wrap_original limitation
parent
552772a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
28 deletions
+8
-28
spec/features/issues/form_spec.rb
spec/features/issues/form_spec.rb
+8
-28
No files found.
spec/features/issues/form_spec.rb
View file @
feae9d3a
...
@@ -26,35 +26,15 @@ describe 'New/edit issue', :feature, :js do
...
@@ -26,35 +26,15 @@ describe 'New/edit issue', :feature, :js do
describe
'shorten users API pagination limit'
do
describe
'shorten users API pagination limit'
do
before
do
before
do
# Using `allow_any_instance_of`/`and_wrap_original`, `original` would
# somehow refer to the very block we defined to _wrap_ that method, instead of
# the original method, resulting in infinite recurison when called.
# This is likely a bug with helper modules included into dynamically generated view classes.
# To work around this, we have to hold on to and call to the original implementation manually.
original_issue_dropdown_options
=
FormHelper
.
instance_method
(
:issue_dropdown_options
)
allow_any_instance_of
(
FormHelper
).
to
receive
(
:issue_dropdown_options
).
and_wrap_original
do
|
original
,
*
args
|
allow_any_instance_of
(
FormHelper
).
to
receive
(
:issue_dropdown_options
).
and_wrap_original
do
|
original
,
*
args
|
has_multiple_assignees
=
*
args
[
1
]
options
=
original_issue_dropdown_options
.
bind
(
original
.
receiver
).
call
(
*
args
)
options
[
:data
][
:per_page
]
=
2
options
=
{
toggle_class:
'js-user-search js-assignee-search js-multiselect js-save-user-data'
,
title:
'Select assignee'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee'
,
placeholder:
'Search users'
,
data:
{
per_page:
1
,
null_user:
true
,
current_user:
true
,
project_id:
project
.
try
(
:id
),
field_name:
"issue[assignee_ids][]"
,
default_label:
'Assignee'
,
'max-select'
:
1
,
'dropdown-header'
:
'Assignee'
,
multi_select:
true
,
'input-meta'
:
'name'
,
'always-show-selectbox'
:
true
}
}
if
has_multiple_assignees
options
[
:title
]
=
'Select assignee(s)'
options
[
:data
][
:'dropdown-header'
]
=
'Assignee(s)'
options
[
:data
].
delete
(
:'max-select'
)
end
options
options
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