diff options
author | Hiroyuki Sato <sathiroyuki@gmail.com> | 2017-11-13 13:14:18 +0900 |
---|---|---|
committer | Hiroyuki Sato <sathiroyuki@gmail.com> | 2017-11-13 18:20:02 +0900 |
commit | 16caf95ccbb9c1930623f6f131b49f974c092150 (patch) | |
tree | 793a500bed4c598af43cb89b6d26534f0c157d35 /spec/controllers/concerns | |
parent | a978e9b98d88837f90eb856b8bb10e3dfbccd712 (diff) | |
download | gitlab-ce-16caf95ccbb9c1930623f6f131b49f974c092150.tar.gz |
Fix filter by my reaction is not working
Diffstat (limited to 'spec/controllers/concerns')
-rw-r--r-- | spec/controllers/concerns/issuable_collections_spec.rb | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb index cd3bf785d34..d7825364ed5 100644 --- a/spec/controllers/concerns/issuable_collections_spec.rb +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -12,12 +12,14 @@ describe IssuableCollections do controller = klass.new - allow(controller).to receive(:params).and_return(state: 'opened') + allow(controller).to receive(:params).and_return(ActionController::Parameters.new(params)) controller end describe '#page_count_for_relation' do + let(:params) { { state: 'opened' } } + it 'returns the number of pages' do relation = double(:relation, limit_value: 20) pages = controller.send(:page_count_for_relation, relation, 28) @@ -25,4 +27,55 @@ describe IssuableCollections do expect(pages).to eq(2) 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 |