diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-14 14:05:37 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-14 14:05:37 +0300 |
commit | acc60818caf34db81f276fa94daea7b6c3a37be4 (patch) | |
tree | 421f8c51b4b813dc7ede7e9dab95d4014ef7d6a8 /spec | |
parent | 6b01821b0d7c7c624ab86936a7cadb82b3603630 (diff) | |
parent | 16caf95ccbb9c1930623f6f131b49f974c092150 (diff) |
Merge branch 'fix-filter-by-my-reaction' into 'master'
Fix filter by my reaction is not working
Closes #39930
See merge request gitlab-org/gitlab-ce!15345
Diffstat (limited to 'spec')
-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 |