blob: a49a89f7f480847b7066d24f8a38a32efcc32072 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
class Hbc::FakeFetcher
def self.fake_response_for(url, response)
@responses[url] = response
end
def self.head(url)
@responses ||= {}
raise("no response faked for #{url.inspect}") unless @responses.key?(url)
@responses[url]
end
def self.init
@responses = {}
end
def self.clear
@responses = {}
end
end
module FakeFetcherHooks
def before_setup
super
Hbc::FakeFetcher.init
end
def after_teardown
super
Hbc::FakeFetcher.clear
end
end
class MiniTest::Spec
include FakeFetcherHooks
end
|