seattlerb/minitest — pull request #373 by teoljungberg (2013-11-30 20:59:10+00:00)
Title: Unmock :tap

I would like to use my mocks around my tests, but still keping them DRY.
So, I propose to "unmock" `:tap` from [mock.rb][mock_klass] so a mock
can be used over any number of examples

```ruby
def my_mock
@my_mock ||= Minitest::Mock.new.tap do |klass|
klass.expect(:foo, 'mocked-value', ['arbitrary-argument'])
end
end
```

Without having to repeat:

```ruby
my_mock = Minitest::Mock.new.tap
my_mock.expect(:foo, 'mocked-value', ['arbitrary-argument'])
```

over the examples to share that behaviour

I know that this can be accomplished by doing:

```ruby
def my_mock
my_mock = Minitest::Mock.new
my_mock.expect(:foo, 'mocked-value', ['arbitrary-argument'])
my_mock
end
```
but I don't see any drawbacks with "umocking" `:tap`.

Thoughts?

[mock_klass]:https://github.com/seattlerb/minitest/blob/master/lib/minitest/mock.rb