Skip to content
Snippets Groups Projects
Commit 6b8d61d1 authored by Felipe Artur's avatar Felipe Artur
Browse files

Fix specs

parent 4c72a03c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -9,6 +9,8 @@ module Gitlab
end
 
def self.valid?(url)
return false unless url
Addressable::URI.parse(url.strip)
 
true
Loading
Loading
Loading
Loading
@@ -265,26 +265,6 @@ describe SnippetsController do
end
end
 
shared_examples "line endings" do |action|
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
shared_examples 'snippet response' do |action|
context 'when the personal snippet is private' do
let(:personal_snippet) { create(:personal_snippet, :private, author: user) }
Loading
Loading
@@ -427,12 +407,10 @@ describe SnippetsController do
end
 
describe "GET #raw" do
include_examples 'line endings', :raw
include_examples 'snippet response', :raw
end
 
describe "GET #download" do
include_examples 'line endings', :download
include_examples 'snippet response', :download
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment