diff options
Diffstat (limited to 'spec/helpers/diff_helper_spec.rb')
-rw-r--r-- | spec/helpers/diff_helper_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb index 0d909e6e140..060c112e20d 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -12,19 +12,32 @@ describe DiffHelper do let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: diff_refs, repository: repository) } describe 'diff_view' do + it 'uses the view param over the cookie' do + controller.params[:view] = 'parallel' + helper.request.cookies[:diff_view] = 'inline' + + expect(helper.diff_view).to eq :parallel + end + + it 'returns the default value when the view param is invalid' do + controller.params[:view] = 'invalid' + + expect(helper.diff_view).to eq :inline + end + it 'returns a valid value when cookie is set' do helper.request.cookies[:diff_view] = 'parallel' expect(helper.diff_view).to eq :parallel end - it 'returns a default value when cookie is invalid' do + it 'returns the default value when cookie is invalid' do helper.request.cookies[:diff_view] = 'invalid' expect(helper.diff_view).to eq :inline end - it 'returns a default value when cookie is nil' do + it 'returns the default value when cookie is nil' do expect(helper.request.cookies).to be_empty expect(helper.diff_view).to eq :inline |