{"action":"created","issue":{"url":"https://api.github.com/repos/seattlerb/minitest/issues/588","labels_url":"https://api.github.com/repos/seattlerb/minitest/issues/588/labels{/name}","comments_url":"https://api.github.com/repos/seattlerb/minitest/issues/588/comments","events_url":"https://api.github.com/repos/seattlerb/minitest/issues/588/events","html_url":"https://github.com/seattlerb/minitest/pull/588","id":111071961,"number":588,"title":"Adds option to verify the number of times a call is made","user":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-12T23:07:25Z","updated_at":"2015-11-01T21:48:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/seattlerb/minitest/pulls/588","html_url":"https://github.com/seattlerb/minitest/pull/588","diff_url":"https://github.com/seattlerb/minitest/pull/588.diff","patch_url":"https://github.com/seattlerb/minitest/pull/588.patch"},"body":"Why:\r\n\r\n* It seems useful to be able to do this, especially in the situation\r\nwhere you want to verify a method is never called, because that wasn't\r\neven possible\r\n\r\nThis change addresses the need by:\r\n\r\n* Storing the expected times with the expected call\r\n* Making sure method_missing allows the call to go through when we\r\nexpect it more than once, even though we have only one record on the\r\nexpected_calls array, while also making sure it will fail if we aren't\r\nexpecting it more than once\r\n* Doing most of the work on verify, to provide a nice error when the\r\nnumber of times we expect a method to be called is not met. This is\r\nopt-in, if you do not add a times option, the verify method won't even\r\ntouch this new code\r\n\r\nAs discussed in #566."},"comment":{"url":"https://api.github.com/repos/seattlerb/minitest/issues/comments/152868185","html_url":"https://github.com/seattlerb/minitest/pull/588#issuecomment-152868185","issue_url":"https://api.github.com/repos/seattlerb/minitest/issues/588","id":152868185,"user":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"created_at":"2015-11-01T21:48:48Z","updated_at":"2015-11-01T21:48:48Z","body":"@pithub I meant to verify that a specific method is not called on the mock. Let's say you have a `DatabaseAdapter` class, and in one test you want to make sure that it doesn't reach to the db and doesn't call the `create_connection` method, although other methods can be called on the mock. \r\n\r\nI don't see that your example fits as a solution for this problem, or am I wrong?"}}