DEV: Fix test to use an actual PNG instead of a GIF.

This commit is contained in:
Guo Xiang Tan 2018-08-07 12:01:58 +08:00
parent 4b000f5d12
commit d1860a4f7d
1 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@ require 'file_helper'
describe FileHelper do
let(:url) { "https://eviltrout.com/trout.png" }
let(:png) { Base64.decode64("R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==") }
let(:png) { File.read("#{Rails.root}/spec/fixtures/images/cropped.png") }
before do
stub_request(:any, /https:\/\/eviltrout.com/)
@ -57,7 +57,8 @@ describe FileHelper do
max_file_size: 10000,
tmp_file_name: 'trouttmp'
)
expect(tmpfile.read[0..5]).to eq("GIF89a")
expect(Base64.encode64(tmpfile.read)).to eq(Base64.encode64(png))
end
it "works with a protocol relative url" do
@ -66,7 +67,8 @@ describe FileHelper do
max_file_size: 10000,
tmp_file_name: 'trouttmp'
)
expect(tmpfile.read[0..5]).to eq("GIF89a")
expect(Base64.encode64(tmpfile.read)).to eq(Base64.encode64(png))
end
describe 'when url is a jpeg' do