Fix linting.

This commit is contained in:
Guo Xiang Tan 2018-08-17 17:34:25 +08:00
parent 16c0ebe8a8
commit 010fe479cb
1 changed files with 44 additions and 36 deletions

View File

@ -52,6 +52,7 @@ describe FileHelper do
end
it "returns a file with the image" do
begin
tmpfile = FileHelper.download(
url,
max_file_size: 10000,
@ -62,8 +63,10 @@ describe FileHelper do
ensure
tmpfile&.close
end
end
it "works with a protocol relative url" do
begin
tmpfile = FileHelper.download(
"//eviltrout.com/trout.png",
max_file_size: 10000,
@ -74,6 +77,7 @@ describe FileHelper do
ensure
tmpfile&.close
end
end
describe 'when max_file_size is exceeded' do
it 'should return nil' do
@ -87,6 +91,7 @@ describe FileHelper do
end
it 'is able to retain the tmpfile' do
begin
tmpfile = FileHelper.download(
"//eviltrout.com/trout.png",
max_file_size: 1,
@ -99,11 +104,13 @@ describe FileHelper do
tmpfile&.close
end
end
end
describe 'when url is a jpeg' do
let(:url) { "https://eviltrout.com/trout.jpg" }
it "should prioritize the content type returned by the response" do
begin
stub_request(:get, url).to_return(body: png, headers: {
"content-type": "image/png"
})
@ -120,5 +127,6 @@ describe FileHelper do
end
end
end
end
end