-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Description
It would be great if we had the ability to unregister a single URI. The use case for this would be in specs, where we would ideally want fake URIs to only last the duration of each example, to decrease dependency on the order in which tests are run. For example:
context "with a FakeWeb URI" do
before do
FakeWeb.register_uri :any, %r{somerequest.com} # ...
end
after do
FakeWeb.unregister_uri %r{somerequest.com}
end
scenario "responds to somerequest.com" do
expect(Net::HTTP).to receive(:get).with(URI.parse "http://somerequest.com/").and_return(anything)
end
end
context "without a FakeWeb URI" do
scenario "doesn't respond to somerequest.com" do
expect(Net::HTTP).to receive(:get).with(URI.parse "http://somerequest.com/").and_return(nil) # or whatever
end
endanthonyto and vrehm
Metadata
Metadata
Assignees
Labels
No labels