Commit 16caf95c authored by Hiroyuki Sato's avatar Hiroyuki Sato

Fix filter by my reaction is not working

parent a978e9b9
...@@ -36,6 +36,7 @@ class IssuableFinder ...@@ -36,6 +36,7 @@ class IssuableFinder
iids iids
label_name label_name
milestone_title milestone_title
my_reaction_emoji
non_archived non_archived
project_id project_id
scope scope
......
---
title: Fix filter by my reaction is not working
merge_request: 15345
author: Hiroyuki Sato
type: fixed
...@@ -12,12 +12,14 @@ describe IssuableCollections do ...@@ -12,12 +12,14 @@ describe IssuableCollections do
controller = klass.new controller = klass.new
allow(controller).to receive(:params).and_return(state: 'opened') allow(controller).to receive(:params).and_return(ActionController::Parameters.new(params))
controller controller
end end
describe '#page_count_for_relation' do describe '#page_count_for_relation' do
let(:params) { { state: 'opened' } }
it 'returns the number of pages' do it 'returns the number of pages' do
relation = double(:relation, limit_value: 20) relation = double(:relation, limit_value: 20)
pages = controller.send(:page_count_for_relation, relation, 28) pages = controller.send(:page_count_for_relation, relation, 28)
...@@ -25,4 +27,55 @@ describe IssuableCollections do ...@@ -25,4 +27,55 @@ describe IssuableCollections do
expect(pages).to eq(2) expect(pages).to eq(2)
end end
end end
describe '#filter_params' do
let(:params) do
{
assignee_id: '1',
assignee_username: 'user1',
author_id: '2',
author_username: 'user2',
authorized_only: 'true',
due_date: '2017-01-01',
group_id: '3',
iids: '4',
label_name: 'foo',
milestone_title: 'bar',
my_reaction_emoji: 'thumbsup',
non_archived: 'true',
project_id: '5',
scope: 'all',
search: 'baz',
sort: 'priority',
state: 'opened',
invalid_param: 'invalid_param'
}
end
it 'filters params' do
allow(controller).to receive(:cookies).and_return({})
filtered_params = controller.send(:filter_params)
expect(filtered_params).to eq({
'assignee_id' => '1',
'assignee_username' => 'user1',
'author_id' => '2',
'author_username' => 'user2',
'authorized_only' => 'true',
'due_date' => '2017-01-01',
'group_id' => '3',
'iids' => '4',
'label_name' => 'foo',
'milestone_title' => 'bar',
'my_reaction_emoji' => 'thumbsup',
'non_archived' => 'true',
'project_id' => '5',
'scope' => 'all',
'search' => 'baz',
'sort' => 'priority',
'state' => 'opened'
})
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment