summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-11-09 22:29:45 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-11-15 01:12:07 +0800
commit2a5319832454fe40cfea151dd7b9e2aa520b3450 (patch)
tree4e996385d7f70ead102fe361f28e43ada80c30da /spec
parent2ade9b4479d7ce1f9b1bebd1e9ca47efb4b6f423 (diff)
downloadgitlab-ce-2a5319832454fe40cfea151dd7b9e2aa520b3450.tar.gz
Refactor whitelisting of filter params
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/concerns/issuable_collections_spec.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb
index d16a3464495..e93c923fd39 100644
--- a/spec/controllers/concerns/issuable_collections_spec.rb
+++ b/spec/controllers/concerns/issuable_collections_spec.rb
@@ -60,7 +60,7 @@ describe IssuableCollections do
end
end
- describe '#filter_params' do
+ describe '#finder_options' do
let(:params) do
{
assignee_id: '1',
@@ -84,25 +84,20 @@ describe IssuableCollections do
}
end
- it 'filters params' do
+ it 'only allows whitelisted params' do
allow(controller).to receive(:cookies).and_return({})
- filtered_params = controller.send(:filter_params)
+ finder_options = controller.send(:finder_options)
- expect(filtered_params).to eq({
+ expect(finder_options).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',
+ 'due_date' => '2017-01-01',
'scope' => 'all',
'search' => 'baz',
'sort' => 'priority',