diff options
author | Rémy Coutable <remy@rymai.me> | 2018-09-04 14:00:31 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-09-04 14:00:31 +0300 |
commit | c181d4fc4b07edbe958799d208e743d85c783d39 (patch) | |
tree | a30914956c4597d2b78b1717d20eae34fbbf604b /spec/controllers | |
parent | 4d41bbd711d95e8def52621db9213dccda348887 (diff) | |
parent | b9cee4ba3c5e22766de771edde2b8d523ee84993 (diff) |
Merge branch 'sh-set-secure-cookies' into 'master'
Set issuable_sort and diff_view cookies to secure when possible
Closes #49120
See merge request gitlab-org/gitlab-ce!21442
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/concerns/issuable_collections_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb index c1f42bbb9d7..d16a3464495 100644 --- a/spec/controllers/concerns/issuable_collections_spec.rb +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -21,6 +21,34 @@ describe IssuableCollections do controller end + describe '#set_set_order_from_cookie' do + describe 'when sort param given' do + let(:cookies) { {} } + let(:params) { { sort: 'downvotes_asc' } } + + it 'sets the cookie with the right values and flags' do + allow(controller).to receive(:cookies).and_return(cookies) + + controller.send(:set_sort_order_from_cookie) + + expect(cookies['issue_sort']).to eq({ value: 'popularity', secure: false, httponly: false }) + end + end + + describe 'when cookie exists' do + let(:cookies) { { 'issue_sort' => 'id_asc' } } + let(:params) { {} } + + it 'sets the cookie with the right values and flags' do + allow(controller).to receive(:cookies).and_return(cookies) + + controller.send(:set_sort_order_from_cookie) + + expect(cookies['issue_sort']).to eq({ value: 'created_asc', secure: false, httponly: false }) + end + end + end + describe '#page_count_for_relation' do let(:params) { { state: 'opened' } } |