summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/drawing/tc_pic.rb5
-rw-r--r--test/tc_helper.rb1
-rw-r--r--test/util/tc_mime_type_utils.rb5
3 files changed, 9 insertions, 2 deletions
diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb
index 34f24eb3..21d3f931 100644
--- a/test/drawing/tc_pic.rb
+++ b/test/drawing/tc_pic.rb
@@ -2,13 +2,16 @@ require 'tc_helper.rb'
class TestPic < Test::Unit::TestCase
def setup
+ stub_request(:get, 'https://example.com/sample-image.png')
+ .to_return(body: File.new('examples/sample.png'), status: 200)
+
@p = Axlsx::Package.new
ws = @p.workbook.add_worksheet
@test_img = @test_img_jpg = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
@test_img_png = File.dirname(__FILE__) + "/../fixtures/image1.png"
@test_img_gif = File.dirname(__FILE__) + "/../fixtures/image1.gif"
@test_img_fake = File.dirname(__FILE__) + "/../fixtures/image1_fake.jpg"
- @test_img_remote_png = "https://via.placeholder.com/150.png"
+ @test_img_remote_png = "https://example.com/sample-image.png"
@test_img_remote_fake = "invalid_URI"
@image = ws.add_image :image_src => @test_img, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?", :opacity => 5
@image_remote = ws.add_image :image_src => @test_img_remote_png, remote: true, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?", :opacity => 5
diff --git a/test/tc_helper.rb b/test/tc_helper.rb
index af40a1e4..fb85870a 100644
--- a/test/tc_helper.rb
+++ b/test/tc_helper.rb
@@ -7,4 +7,5 @@ end
require 'test/unit'
require "timecop"
+require 'webmock/test_unit'
require "axlsx.rb"
diff --git a/test/util/tc_mime_type_utils.rb b/test/util/tc_mime_type_utils.rb
index 9d116931..52c49e2e 100644
--- a/test/util/tc_mime_type_utils.rb
+++ b/test/util/tc_mime_type_utils.rb
@@ -1,8 +1,11 @@
require 'tc_helper.rb'
class TestMimeTypeUtils < Test::Unit::TestCase
def setup
+ stub_request(:get, 'https://example.com/sample-image.png')
+ .to_return(body: File.new('examples/sample.png'), status: 200)
+
@test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
- @test_img_url = "https://via.placeholder.com/150.png"
+ @test_img_url = "https://example.com/sample-image.png"
end
def teardown