Skip to content

A platform for community discussion. Free, open, simple.

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

Guo Xiang Tand1860a4f7d85
diff --git a/spec/components/file_helper_spec.rb b/spec/components/file_helper_spec.rb
index b481260ed77..2dc2dabd1b5 100644
--- a/spec/components/file_helper_spec.rb
+++ b/spec/components/file_helper_spec.rb
@@ -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