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