diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-02-06 18:04:00 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-02-20 09:24:03 +0300 |
commit | c9d687d6fed8ee9d0b9dfd1ebb55ddbb30b39fe2 (patch) | |
tree | 9ae2c095936d3c128401e72fc52d0d583aa3b1dc /spec/controllers/snippets_controller_spec.rb | |
parent | b88e82ff0a1bca9687b5579208ba05a99e41a464 (diff) |
Download snippets with LF line-endings by default
Diffstat (limited to 'spec/controllers/snippets_controller_spec.rb')
-rw-r--r-- | spec/controllers/snippets_controller_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index dadcb90cfc2..f90c0d76ceb 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -286,6 +286,24 @@ describe SnippetsController do expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_http_status(200) end + + context 'CRLF line ending' do + let(:personal_snippet) do + create(:personal_snippet, :public, author: user, content: "first line\r\nsecond line\r\nthird line") + end + + it 'returns LF line endings by default' do + get action, id: personal_snippet.to_param + + expect(response.body).to eq("first line\nsecond line\nthird line") + end + + it 'does not convert line endings when parameter present' do + get action, id: personal_snippet.to_param, line_ending: :raw + + expect(response.body).to eq("first line\r\nsecond line\r\nthird line") + end + end end context 'when not signed in' do |