diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-09 17:29:45 +0300 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-14 20:12:07 +0300 |
commit | 2a5319832454fe40cfea151dd7b9e2aa520b3450 (patch) | |
tree | 4e996385d7f70ead102fe361f28e43ada80c30da /spec/controllers/concerns | |
parent | 2ade9b4479d7ce1f9b1bebd1e9ca47efb4b6f423 (diff) |
Refactor whitelisting of filter params
Diffstat (limited to 'spec/controllers/concerns')
-rw-r--r-- | spec/controllers/concerns/issuable_collections_spec.rb | 15 |
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', |