Remove test_cask, fake_fetcher, and fake_response_for methods.
This commit is contained in:
parent
a6c3ba7d86
commit
40a197f216
@ -3,15 +3,17 @@ require "test_helper"
|
|||||||
describe Hbc::UrlChecker do
|
describe Hbc::UrlChecker do
|
||||||
describe "request processing" do
|
describe "request processing" do
|
||||||
it "adds an error if response is empty" do
|
it "adds an error if response is empty" do
|
||||||
cask = TestHelper.test_cask
|
cask = Hbc.load("basic-cask")
|
||||||
TestHelper.fake_response_for(cask.url, "")
|
Hbc::FakeFetcher.fake_response_for(cask.url, "")
|
||||||
checker = Hbc::UrlChecker.new(cask, TestHelper.fake_fetcher)
|
checker = Hbc::UrlChecker.new(cask, Hbc::FakeFetcher)
|
||||||
checker.run
|
checker.run
|
||||||
checker.errors.must_include "timeout while requesting #{cask.url}"
|
checker.errors.must_include "timeout while requesting #{cask.url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "properly populates the response code and headers from an http response" do
|
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
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/x-apple-diskimage
|
Content-Type: application/x-apple-diskimage
|
||||||
ETag: "b4208f3e84967be4b078ecaa03fba941"
|
ETag: "b4208f3e84967be4b078ecaa03fba941"
|
||||||
@ -19,7 +21,7 @@ describe Hbc::UrlChecker do
|
|||||||
Last-Modified: Sun, 12 Aug 2012 21:17:21 GMT
|
Last-Modified: Sun, 12 Aug 2012 21:17:21 GMT
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
checker = Hbc::UrlChecker.new(TestHelper.test_cask, TestHelper.fake_fetcher)
|
checker = Hbc::UrlChecker.new(cask, Hbc::FakeFetcher)
|
||||||
checker.run
|
checker.run
|
||||||
checker.response_status.must_equal "HTTP/1.1 200 OK"
|
checker.response_status.must_equal "HTTP/1.1 200 OK"
|
||||||
checker.headers.must_equal("Content-Type" => "application/x-apple-diskimage",
|
checker.headers.must_equal("Content-Type" => "application/x-apple-diskimage",
|
||||||
|
|||||||
@ -62,18 +62,6 @@ class TestHelper
|
|||||||
"file://" + local_binary_path(name)
|
"file://" + local_binary_path(name)
|
||||||
end
|
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)
|
def self.valid_alias?(candidate)
|
||||||
return false unless candidate.symlink?
|
return false unless candidate.symlink?
|
||||||
candidate.readlink.exist?
|
candidate.readlink.exist?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user