diff options
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb index afdd3f9..689928c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -48,26 +48,22 @@ class Minitest::Test def stub_sks_get_reponse(key_id, opts = {}) options = {status: 200, body: ""}.merge(opts) - stub_http_request(:get, Nickserver::Config.hkp_url).with( + stub_http_request(:get, config.hkp_url).with( query: {op: 'get', search: "0x"+key_id, exact: 'on', options: 'mr'} ).to_return(options) end def stub_couch_response(uid, opts = {}) # can't stub localhost, so set couch_host to anything else - Nickserver::Config.stub :couch_host, 'notlocalhost' do + config.stub :couch_host, 'notlocalhost' do options = {status: 200, body: ""}.merge(opts) query = "\?key=#{"%22#{uid}%22"}&reduce=false" - stub_http_request(:get, /#{Regexp.escape(Nickserver::Config.couch_url)}.*#{query}/).to_return(options) + stub_http_request(:get, /#{Regexp.escape(config.couch_url)}.*#{query}/).to_return(options) yield end end - # - # temporarily stubs the config property for the duration of the given block - # - def stub_config(property, value, &block) - Nickserver::Config.stub(property, value, &block) + def config + Nickserver::Config end - end |