mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
DEV: Fix test to use an actual PNG instead of a GIF.
This commit is contained in:
@ -4,7 +4,7 @@ require 'file_helper'
|
|||||||
describe FileHelper do
|
describe FileHelper do
|
||||||
|
|
||||||
let(:url) { "https://eviltrout.com/trout.png" }
|
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
|
before do
|
||||||
stub_request(:any, /https:\/\/eviltrout.com/)
|
stub_request(:any, /https:\/\/eviltrout.com/)
|
||||||
@ -57,7 +57,8 @@ describe FileHelper do
|
|||||||
max_file_size: 10000,
|
max_file_size: 10000,
|
||||||
tmp_file_name: 'trouttmp'
|
tmp_file_name: 'trouttmp'
|
||||||
)
|
)
|
||||||
expect(tmpfile.read[0..5]).to eq("GIF89a")
|
|
||||||
|
expect(Base64.encode64(tmpfile.read)).to eq(Base64.encode64(png))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works with a protocol relative url" do
|
it "works with a protocol relative url" do
|
||||||
@ -66,7 +67,8 @@ describe FileHelper do
|
|||||||
max_file_size: 10000,
|
max_file_size: 10000,
|
||||||
tmp_file_name: 'trouttmp'
|
tmp_file_name: 'trouttmp'
|
||||||
)
|
)
|
||||||
expect(tmpfile.read[0..5]).to eq("GIF89a")
|
|
||||||
|
expect(Base64.encode64(tmpfile.read)).to eq(Base64.encode64(png))
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when url is a jpeg' do
|
describe 'when url is a jpeg' do
|
||||||
|
Reference in New Issue
Block a user