test/test_ping.rb in jekyll-chatgpt-translate-0.0.9 vs test/test_ping.rb in jekyll-chatgpt-translate-0.0.10
- old
+ new
@@ -23,10 +23,11 @@
# SOFTWARE.
require 'minitest/autorun'
require 'webmock/minitest'
require 'jekyll'
+require 'tempfile'
require_relative '../lib/jekyll-chatgpt-translate/ping'
# Ping test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023 Yegor Bugayenko
@@ -42,17 +43,21 @@
def test_when_exists
stub_request(:any, 'https://www.yegor256.com/about-me.html')
site = FakeSite.new({ 'url' => 'https://www.yegor256.com/' })
ping = GptTranslate::Ping.new(site, '/about-me.html')
- assert(!ping.exists?)
+ Tempfile.open do |f|
+ assert(!ping.found?(f))
+ end
end
def test_when_not_exists
stub_request(:any, 'https://www.yegor256.com/absent.html').to_return(status: 404)
site = FakeSite.new({ 'url' => 'https://www.yegor256.com/' })
ping = GptTranslate::Ping.new(site, '/absent.html')
- assert(!ping.exists?)
+ Tempfile.open do |f|
+ assert(!ping.found?(f))
+ end
end
def test_relative_path
assert_raises do
GptTranslate::Ping.new({}, '404.html')