GitHub PullRequestEvent at 2014-06-18 15:19:22
Repository: assert
Actor: kellyredding
Payload: {"action":"closed","number":196,"pull_request":{"url":"https://api.github.com/repos/redding/assert/pulls/196","id":17276103,"html_url":"https://github.com/redding/assert/pull/196","diff_url":"https://github.com/redding/assert/pull/196.diff","patch_url":"https://github.com/redding/assert/pull/196.patch","issue_url":"https://api.github.com/repos/redding/assert/issues/196","number":196,"state":"closed","title":"fix stubbing when methods are not local to the object","user":{"login":"kellyredding","id":82110,"avatar_url":"https://avatars.githubusercontent.com/u/82110?","gravatar_id":"94336f4759a25a19f543c0b7b3eef70d","url":"https://api.github.com/users/kellyredding","html_url":"https://github.com/kellyredding","followers_url":"https://api.github.com/users/kellyredding/followers","following_url":"https://api.github.com/users/kellyredding/following{/other_user}","gists_url":"https://api.github.com/users/kellyredding/gists{/gist_id}","starred_url":"https://api.github.com/users/kellyredding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellyredding/subscriptions","organizations_url":"https://api.github.com/users/kellyredding/orgs","repos_url":"https://api.github.com/users/kellyredding/repos","events_url":"https://api.github.com/users/kellyredding/events{/privacy}","received_events_url":"https://api.github.com/users/kellyredding/received_events","type":"User","site_admin":false},"body":"This case mainly applies to objects that delegate method calls.  When\r\nstubbing, assert will define the method locally on the object first\r\nbefore method-chaining the stubbed method.  Defining this method\r\nneeds to be done a certain way to avoid erroneous arity mismatches.\r\n\r\nThe \"bug\" or \"feature\" is that when defining a method using\r\n`define_method`, if a block is specified as an arg, the newly defined\r\nmethod will always have an arity of 1 (no matter what the actual\r\narity should be).  This causes incorrect arity mismatches if you\r\nstub with any other arity.\r\n\r\nThis changes the way the method is defined to instead class eval\r\na string traditionally defining the method with the name interpolated.\r\nThis causes the method to have a correct arity and solves the\r\nwrong arity mismatches.\r\n\r\nOur tests missed this for two reasons.  One, we were just testing\r\nthe subclass scenario.  In this scenario superclass methods are\r\nstill local to the subclass, so this above handling is never invoked.\r\nTwo, the method we were using in the tests has an arity of 1 so it\r\nwouldn't have mismatched anyway.\r\n\r\nTo improve the tests, I switched from a subclass to a delegate object\r\nand switched to using a method with a non-1 arity.\r\n\r\n@jcredding ready for review.","created_at":"2014-06-18T05:32:44Z","updated_at":"2014-06-18T15:19:22Z","closed_at":"2014-06-18T15:19:22Z","merged_at":"2014-06-18T15:19:22Z","merge_commit_sha":"70e194ff89cefcf47cf2c6f42aee9fb62e76eaea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/redding/assert/pulls/196/commits","review_comments_url":"https://api.github.com/repos/redding/assert/pulls/196/comments","review_comment_url":"https://api.github.com/repos/redding/assert/pulls/comments/{number}","comments_url":"https://api.github.com/repos/redding/assert/issues/196/comments","statuses_url":"https://api.github.com/repos/redding/assert/statuses/f18df838d6315ca1bbec5e4ea75c959d7fe9691f","head":{"label":"redding:kr-stubfix","ref":"kr-stubfix","sha":"f18df838d6315ca1bbec5e4ea75c959d7fe9691f","user":{"login":"redding","id":2427810,"avatar_url":"https://avatars.githubusercontent.com/u/2427810?","gravatar_id":"f74cdff3283b63bb1acf135a46153569","url":"https://api.github.com/users/redding","html_url":"https://github.com/redding","followers_url":"https://api.github.com/users/redding/followers","following_url":"https://api.github.com/users/redding/following{/other_user}","gists_url":"https://api.github.com/users/redding/gists{/gist_id}","starred_url":"https://api.github.com/users/redding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redding/subscriptions","organizations_url":"https://api.github.com/users/redding/orgs","repos_url":"https://api.github.com/users/redding/repos","events_url":"https://api.github.com/users/redding/events{/privacy}","received_events_url":"https://api.github.com/users/redding/received_events","type":"Organization","site_admin":false},"repo":{"id":2175297,"name":"assert","full_name":"redding/assert","owner":{"login":"redding","id":2427810,"avatar_url":"https://avatars.githubusercontent.com/u/2427810?","gravatar_id":"f74cdff3283b63bb1acf135a46153569","url":"https://api.github.com/users/redding","html_url":"https://github.com/redding","followers_url":"https://api.github.com/users/redding/followers","following_url":"https://api.github.com/users/redding/following{/other_user}","gists_url":"https://api.github.com/users/redding/gists{/gist_id}","starred_url":"https://api.github.com/users/redding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redding/subscriptions","organizations_url":"https://api.github.com/users/redding/orgs","repos_url":"https://api.github.com/users/redding/repos","events_url":"https://api.github.com/users/redding/events{/privacy}","received_events_url":"https://api.github.com/users/redding/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redding/assert","description":"Test::Unit style testing framework, just better than Test::Unit.","fork":false,"url":"https://api.github.com/repos/redding/assert","forks_url":"https://api.github.com/repos/redding/assert/forks","keys_url":"https://api.github.com/repos/redding/assert/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redding/assert/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redding/assert/teams","hooks_url":"https://api.github.com/repos/redding/assert/hooks","issue_events_url":"https://api.github.com/repos/redding/assert/issues/events{/number}","events_url":"https://api.github.com/repos/redding/assert/events","assignees_url":"https://api.github.com/repos/redding/assert/assignees{/user}","branches_url":"https://api.github.com/repos/redding/assert/branches{/branch}","tags_url":"https://api.github.com/repos/redding/assert/tags","blobs_url":"https://api.github.com/repos/redding/assert/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redding/assert/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redding/assert/git/refs{/sha}","trees_url":"https://api.github.com/repos/redding/assert/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redding/assert/statuses/{sha}","languages_url":"https://api.github.com/repos/redding/assert/languages","stargazers_url":"https://api.github.com/repos/redding/assert/stargazers","contributors_url":"https://api.github.com/repos/redding/assert/contributors","subscribers_url":"https://api.github.com/repos/redding/assert/subscribers","subscription_url":"https://api.github.com/repos/redding/assert/subscription","commits_url":"https://api.github.com/repos/redding/assert/commits{/sha}","git_commits_url":"https://api.github.com/repos/redding/assert/git/commits{/sha}","comments_url":"https://api.github.com/repos/redding/assert/comments{/number}","issue_comment_url":"https://api.github.com/repos/redding/assert/issues/comments/{number}","contents_url":"https://api.github.com/repos/redding/assert/contents/{+path}","compare_url":"https://api.github.com/repos/redding/assert/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redding/assert/merges","archive_url":"https://api.github.com/repos/redding/assert/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redding/assert/downloads","issues_url":"https://api.github.com/repos/redding/assert/issues{/number}","pulls_url":"https://api.github.com/repos/redding/assert/pulls{/number}","milestones_url":"https://api.github.com/repos/redding/assert/milestones{/number}","notifications_url":"https://api.github.com/repos/redding/assert/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redding/assert/labels{/name}","releases_url":"https://api.github.com/repos/redding/assert/releases{/id}","created_at":"2011-08-08T19:08:49Z","updated_at":"2014-06-18T15:19:22Z","pushed_at":"2014-06-18T15:19:22Z","git_url":"git://github.com/redding/assert.git","ssh_url":"git@github.com:redding/assert.git","clone_url":"https://github.com/redding/assert.git","svn_url":"https://github.com/redding/assert","homepage":"","size":1826,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":5,"default_branch":"master"}},"base":{"label":"redding:master","ref":"master","sha":"809fd72c7dde5f8c33fac6a271a27c7207bf5615","user":{"login":"redding","id":2427810,"avatar_url":"https://avatars.githubusercontent.com/u/2427810?","gravatar_id":"f74cdff3283b63bb1acf135a46153569","url":"https://api.github.com/users/redding","html_url":"https://github.com/redding","followers_url":"https://api.github.com/users/redding/followers","following_url":"https://api.github.com/users/redding/following{/other_user}","gists_url":"https://api.github.com/users/redding/gists{/gist_id}","starred_url":"https://api.github.com/users/redding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redding/subscriptions","organizations_url":"https://api.github.com/users/redding/orgs","repos_url":"https://api.github.com/users/redding/repos","events_url":"https://api.github.com/users/redding/events{/privacy}","received_events_url":"https://api.github.com/users/redding/received_events","type":"Organization","site_admin":false},"repo":{"id":2175297,"name":"assert","full_name":"redding/assert","owner":{"login":"redding","id":2427810,"avatar_url":"https://avatars.githubusercontent.com/u/2427810?","gravatar_id":"f74cdff3283b63bb1acf135a46153569","url":"https://api.github.com/users/redding","html_url":"https://github.com/redding","followers_url":"https://api.github.com/users/redding/followers","following_url":"https://api.github.com/users/redding/following{/other_user}","gists_url":"https://api.github.com/users/redding/gists{/gist_id}","starred_url":"https://api.github.com/users/redding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redding/subscriptions","organizations_url":"https://api.github.com/users/redding/orgs","repos_url":"https://api.github.com/users/redding/repos","events_url":"https://api.github.com/users/redding/events{/privacy}","received_events_url":"https://api.github.com/users/redding/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redding/assert","description":"Test::Unit style testing framework, just better than Test::Unit.","fork":false,"url":"https://api.github.com/repos/redding/assert","forks_url":"https://api.github.com/repos/redding/assert/forks","keys_url":"https://api.github.com/repos/redding/assert/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redding/assert/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redding/assert/teams","hooks_url":"https://api.github.com/repos/redding/assert/hooks","issue_events_url":"https://api.github.com/repos/redding/assert/issues/events{/number}","events_url":"https://api.github.com/repos/redding/assert/events","assignees_url":"https://api.github.com/repos/redding/assert/assignees{/user}","branches_url":"https://api.github.com/repos/redding/assert/branches{/branch}","tags_url":"https://api.github.com/repos/redding/assert/tags","blobs_url":"https://api.github.com/repos/redding/assert/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redding/assert/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redding/assert/git/refs{/sha}","trees_url":"https://api.github.com/repos/redding/assert/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redding/assert/statuses/{sha}","languages_url":"https://api.github.com/repos/redding/assert/languages","stargazers_url":"https://api.github.com/repos/redding/assert/stargazers","contributors_url":"https://api.github.com/repos/redding/assert/contributors","subscribers_url":"https://api.github.com/repos/redding/assert/subscribers","subscription_url":"https://api.github.com/repos/redding/assert/subscription","commits_url":"https://api.github.com/repos/redding/assert/commits{/sha}","git_commits_url":"https://api.github.com/repos/redding/assert/git/commits{/sha}","comments_url":"https://api.github.com/repos/redding/assert/comments{/number}","issue_comment_url":"https://api.github.com/repos/redding/assert/issues/comments/{number}","contents_url":"https://api.github.com/repos/redding/assert/contents/{+path}","compare_url":"https://api.github.com/repos/redding/assert/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redding/assert/merges","archive_url":"https://api.github.com/repos/redding/assert/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redding/assert/downloads","issues_url":"https://api.github.com/repos/redding/assert/issues{/number}","pulls_url":"https://api.github.com/repos/redding/assert/pulls{/number}","milestones_url":"https://api.github.com/repos/redding/assert/milestones{/number}","notifications_url":"https://api.github.com/repos/redding/assert/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redding/assert/labels{/name}","releases_url":"https://api.github.com/repos/redding/assert/releases{/id}","created_at":"2011-08-08T19:08:49Z","updated_at":"2014-06-18T15:19:22Z","pushed_at":"2014-06-18T15:19:22Z","git_url":"git://github.com/redding/assert.git","ssh_url":"git@github.com:redding/assert.git","clone_url":"https://github.com/redding/assert.git","svn_url":"https://github.com/redding/assert","homepage":"","size":1826,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/redding/assert/pulls/196"},"html":{"href":"https://github.com/redding/assert/pull/196"},"issue":{"href":"https://api.github.com/repos/redding/assert/issues/196"},"comments":{"href":"https://api.github.com/repos/redding/assert/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/redding/assert/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/redding/assert/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/redding/assert/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/redding/assert/statuses/f18df838d6315ca1bbec5e4ea75c959d7fe9691f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"kellyredding","id":82110,"avatar_url":"https://avatars.githubusercontent.com/u/82110?","gravatar_id":"94336f4759a25a19f543c0b7b3eef70d","url":"https://api.github.com/users/kellyredding","html_url":"https://github.com/kellyredding","followers_url":"https://api.github.com/users/kellyredding/followers","following_url":"https://api.github.com/users/kellyredding/following{/other_user}","gists_url":"https://api.github.com/users/kellyredding/gists{/gist_id}","starred_url":"https://api.github.com/users/kellyredding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellyredding/subscriptions","organizations_url":"https://api.github.com/users/kellyredding/orgs","repos_url":"https://api.github.com/users/kellyredding/repos","events_url":"https://api.github.com/users/kellyredding/events{/privacy}","received_events_url":"https://api.github.com/users/kellyredding/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":25,"deletions":13,"changed_files":2}}