{"action":"created","issue":{"url":"https://api.github.com/repos/rspec/rspec-mocks/issues/1043","labels_url":"https://api.github.com/repos/rspec/rspec-mocks/issues/1043/labels{/name}","comments_url":"https://api.github.com/repos/rspec/rspec-mocks/issues/1043/comments","events_url":"https://api.github.com/repos/rspec/rspec-mocks/issues/1043/events","html_url":"https://github.com/rspec/rspec-mocks/pull/1043","id":123026906,"number":1043,"title":"Only restore an instance method on the owning class","user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-12-18T21:13:08Z","updated_at":"2015-12-24T13:11:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rspec/rspec-mocks/pulls/1043","html_url":"https://github.com/rspec/rspec-mocks/pull/1043","diff_url":"https://github.com/rspec/rspec-mocks/pull/1043.diff","patch_url":"https://github.com/rspec/rspec-mocks/pull/1043.patch"},"body":"Fixes #1042\r\n\r\n```ruby\r\nclass Shape\r\n  def area(value)\r\n    value\r\n  end\r\nend\r\n\r\nclass Circle < Shape\r\n  def area\r\n    super(2)\r\n  end\r\nend\r\n\r\nclass SmallCircle < Circle\r\nend\r\n```\r\n\r\nWhen using: allow_any_instance_of(SmallCircle).to receive(:area)\r\n\r\nPreviously, we'd copy the area method from the first superclass\r\nthat implements it.  In this case, we'd copy Circle#area into\r\nSmallCircle with a backup name.\r\n\r\nAt the end of the example, we'd remove the stubbing and rename the\r\ncopied method back, causing SmallCircle to implement area when it never\r\ndid previously.\r\n\r\nAny calls to SmallCircle#area would end up calling the contents of\r\nCircle#area and the call to super(2) would be sent to the wrong class:\r\nCircle, not Shape.  In this case, Circle#area doesn't take any\r\narguments so you get an ArgumentError.\r\n\r\nPreviously, ruby 2.2 and below allowed this strange behavior to work.\r\n\r\nThis appears to have been \"fixed\" in ruby in this commit:\r\nhttps://github.com/ruby/ruby/commit/c8854d2ca4be9ee6946e6d17b0e17d9ef130ee81"},"comment":{"url":"https://api.github.com/repos/rspec/rspec-mocks/issues/comments/167107715","html_url":"https://github.com/rspec/rspec-mocks/pull/1043#issuecomment-167107715","issue_url":"https://api.github.com/repos/rspec/rspec-mocks/issues/1043","id":167107715,"user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"created_at":"2015-12-24T13:11:24Z","updated_at":"2015-12-24T13:11:24Z","body":"Thank you @deivid-rodriguez and @JonRowe.\r\n\r\n@JonRowe This branch was already rebased.  I wasn't sure if you wanted me to run the build again, in case you a dependency was updated... so I amended my commit and force pushed to restart the travis build.\r\n\r\nLet me know if there's something else you would like.\r\n\r\nThanks!"}}