How to: unregister an URI in FakeWeb
# app/config/initializers/extra_fakeweb.rb
module FakeWeb
class Registry
def unregister_uri(method, uri)
uri_map[normalize_uri(uri)][method] = {}
end
end
def self.unregister_uri(*args)
case args.length
when 2
Registry.instance.unregister_uri(*args)
else
raise ArgumentError.new("wrong number of arguments (#{args.length} for 2)")
end
end
end
Call:
FakeWeb.unregister(:get, "http://www.google.com")
Written by Tu Hoang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#