Remove test_cask, fake_fetcher, and fake_response_for methods.

This commit is contained in:
Markus Reiter 2016-10-21 17:01:37 +02:00
parent a6c3ba7d86
commit 40a197f216
2 changed files with 7 additions and 17 deletions

View File

@ -3,15 +3,17 @@ require "test_helper"
describe Hbc::UrlChecker do
describe "request processing" do
it "adds an error if response is empty" do
cask = TestHelper.test_cask
TestHelper.fake_response_for(cask.url, "")
checker = Hbc::UrlChecker.new(cask, TestHelper.fake_fetcher)
cask = Hbc.load("basic-cask")
Hbc::FakeFetcher.fake_response_for(cask.url, "")
checker = Hbc::UrlChecker.new(cask, Hbc::FakeFetcher)
checker.run
checker.errors.must_include "timeout while requesting #{cask.url}"
end
it "properly populates the response code and headers from an http response" do
TestHelper.fake_response_for(TestHelper.test_cask.url, <<-EOS.undent)
cask = Hbc.load("basic-cask")
Hbc::FakeFetcher.fake_response_for(cask.url, <<-EOS.undent)
HTTP/1.1 200 OK
Content-Type: application/x-apple-diskimage
ETag: "b4208f3e84967be4b078ecaa03fba941"
@ -19,7 +21,7 @@ describe Hbc::UrlChecker do
Last-Modified: Sun, 12 Aug 2012 21:17:21 GMT
EOS
checker = Hbc::UrlChecker.new(TestHelper.test_cask, TestHelper.fake_fetcher)
checker = Hbc::UrlChecker.new(cask, Hbc::FakeFetcher)
checker.run
checker.response_status.must_equal "HTTP/1.1 200 OK"
checker.headers.must_equal("Content-Type" => "application/x-apple-diskimage",

View File

@ -62,18 +62,6 @@ class TestHelper
"file://" + local_binary_path(name)
end
def self.test_cask
@test_cask ||= Hbc.load("basic-cask")
end
def self.fake_fetcher
Hbc::FakeFetcher
end
def self.fake_response_for(*args)
Hbc::FakeFetcher.fake_response_for(*args)
end
def self.valid_alias?(candidate)
return false unless candidate.symlink?
candidate.readlink.exist?