diff --git a/docsite/source/testing.html.md b/docsite/source/testing.html.md index 9e90908..815ee14 100644 --- a/docsite/source/testing.html.md +++ b/docsite/source/testing.html.md @@ -37,3 +37,21 @@ container[:redis] # => "Stubbed redis instance" container.unstub(:redis) # => "Redis instance" ``` + +To clear all stubs at once, call `#unstub` without any arguments: + +```ruby +container = Dry::Container.new +container.register(:redis) { "Redis instance" } +container.register(:db) { "DB instance" } + +require 'dry/container/stub' +container.enable_stubs! +container.stub(:redis, "Stubbed redis instance") +container.stub(:db, "Stubbed DB instance") + +container.unstub # This will unstub all previously stubbed keys + +container[:redis] # => "Redis instance" +container[:db] # => "Redis instance" +```