{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/20784","labels_url":"https://api.github.com/repos/rails/rails/issues/20784/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/20784/comments","events_url":"https://api.github.com/repos/rails/rails/issues/20784/events","html_url":"https://github.com/rails/rails/pull/20784","id":93110204,"number":20784,"title":"Add method call assertions for internal use.","user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activesupport","name":"activesupport","color":"FC9300"},{"url":"https://api.github.com/repos/rails/rails/labels/needs%20feedback","name":"needs feedback","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"milestone":null,"comments":21,"created_at":"2015-07-05T13:09:30Z","updated_at":"2015-07-08T19:17:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/20784","html_url":"https://github.com/rails/rails/pull/20784","diff_url":"https://github.com/rails/rails/pull/20784.diff","patch_url":"https://github.com/rails/rails/pull/20784.patch"},"body":"Prompted by the discussion in https://github.com/rails/rails/pull/20457.\r\n\r\nWe're trying to remove the use of Mocha in Rails and finding some cases where going with a stub and mock yields hard to read code. Here's an example from #20457:\r\n\r\n```ruby\r\nmock = Minitest::Mock.new\r\nmock.expect(:call, nil, [])\r\noriginal.stub(:delete, mock) do\r\n  original.except(:a)\r\nend\r\nassert_equal \"expected call() => nil, got []\", assert_raises(MockExpectationError) { mock.verify }.message\r\n```\r\n\r\nInstead I've added `assert_called` and `assert_not_called` to boil down the boilerplate we need to write\r\nto assert methods are called a certain number of times.\r\n\r\n```ruby\r\nassert_not_called(original, :delete) { original.except(:a) }\r\n```\r\n\r\nAs we generally want people to use shy away from behavior testing when contributing I've marked these as `:nodoc:`.\r\n\r\ncc @matthewd @ronakjangir47 @andycroll"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/119701781","html_url":"https://github.com/rails/rails/pull/20784#issuecomment-119701781","issue_url":"https://api.github.com/repos/rails/rails/issues/20784","id":119701781,"user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T19:17:30Z","updated_at":"2015-07-08T19:17:30Z","body":"@ronakjangir47 good point. I've followed the approach used in `active_support/testing/stream.rb`, see the tests for usage.\r\n\r\nI'll check Travis and merge if it's green."}}