{"action":"created","comment":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/comments/74659284","id":74659284,"diff_hunk":"@@ -13,53 +13,46 @@ def teardown\n     FileUtils.rm_rf @dir\n   end\n \n-  def formula_text(name, text)\n+  def formula_text(name, body = nil, patch = nil)\n     path = Pathname.new \"#{@dir}/#{name}.rb\"\n-    path.open(\"w\") { |f| f.write text }\n+    path.open(\"w\") do |f|\n+      f.write <<-EOS.undent\n+        class #{Formulary.class_s(name)} < Formula\n+          #{body}\n+        end\n+        #{patch}\n+      EOS\n+    end\n     FormulaText.new path\n   end\n \n   def test_simple_valid_formula\n-    ft = formula_text \"valid\", <<-EOS.undent\n-      class Valid < Formula\n-        url \"http://www.example.com/valid-1.0.tar.gz\"\n-      end\n-    EOS\n+    ft = formula_text \"valid\", 'url \"http://www.example.com/valid-1.0.tar.gz\"'\n \n     refute ft.has_DATA?, \"The formula doesn't have DATA\"\n     refute ft.has_END?, \"The formula doesn't have __END__\"\n-    assert ft.has_trailing_newline?, \"The formula have a trailing newline\"\n+    assert ft.has_trailing_newline?, \"The formula has a trailing newline\"\n \n-    assert ft =~ /\\burl\\b/, \"The formula match 'url'\"\n+    assert ft =~ /\\burl\\b/, \"The formula matches 'url'\"\n     assert_nil ft.line_number(/desc/), \"The formula doesn't match 'desc'\"\n     assert_equal 2, ft.line_number(/\\burl\\b/)\n+    assert ft.include?(\"Valid\"), \"The formula includes \\\"Valid\\\"\"","path":"Library/Homebrew/test/test_cmd_audit.rb","position":36,"original_position":36,"commit_id":"d355ab1ac1dc80d56e38d098b49b516f38201b91","original_commit_id":"d355ab1ac1dc80d56e38d098b49b516f38201b91","user":{"login":"MikeMcQuaid","id":125011,"avatar_url":"https://avatars.githubusercontent.com/u/125011?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeMcQuaid","html_url":"https://github.com/MikeMcQuaid","followers_url":"https://api.github.com/users/MikeMcQuaid/followers","following_url":"https://api.github.com/users/MikeMcQuaid/following{/other_user}","gists_url":"https://api.github.com/users/MikeMcQuaid/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeMcQuaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeMcQuaid/subscriptions","organizations_url":"https://api.github.com/users/MikeMcQuaid/orgs","repos_url":"https://api.github.com/users/MikeMcQuaid/repos","events_url":"https://api.github.com/users/MikeMcQuaid/events{/privacy}","received_events_url":"https://api.github.com/users/MikeMcQuaid/received_events","type":"User","site_admin":true},"body":"Cool, that's fine as-is then, thanks for checking 👍 ","created_at":"2016-08-12T20:58:31Z","updated_at":"2016-08-12T20:58:31Z","html_url":"https://github.com/Homebrew/brew/pull/682#discussion_r74659284","pull_request_url":"https://api.github.com/repos/Homebrew/brew/pulls/682","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments/74659284"},"html":{"href":"https://github.com/Homebrew/brew/pull/682#discussion_r74659284"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/682"}}},"pull_request":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/682","id":80893045,"html_url":"https://github.com/Homebrew/brew/pull/682","diff_url":"https://github.com/Homebrew/brew/pull/682.diff","patch_url":"https://github.com/Homebrew/brew/pull/682.patch","issue_url":"https://api.github.com/repos/Homebrew/brew/issues/682","number":682,"state":"open","locked":false,"title":"tests: refactor FormulaTextTests in test_cmd_audit, add assertion to test_simple_valid_formula","user":{"login":"eirinikos","id":9170701,"avatar_url":"https://avatars.githubusercontent.com/u/9170701?v=3","gravatar_id":"","url":"https://api.github.com/users/eirinikos","html_url":"https://github.com/eirinikos","followers_url":"https://api.github.com/users/eirinikos/followers","following_url":"https://api.github.com/users/eirinikos/following{/other_user}","gists_url":"https://api.github.com/users/eirinikos/gists{/gist_id}","starred_url":"https://api.github.com/users/eirinikos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eirinikos/subscriptions","organizations_url":"https://api.github.com/users/eirinikos/orgs","repos_url":"https://api.github.com/users/eirinikos/repos","events_url":"https://api.github.com/users/eirinikos/events{/privacy}","received_events_url":"https://api.github.com/users/eirinikos/received_events","type":"User","site_admin":false},"body":"- [x] Have you followed the guidelines in our [Contributing](https://github.com/Homebrew/brew/blob/master/.github/CONTRIBUTING.md) document?\r\n- [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/Homebrew/brew/pulls) for the same change?\r\n- [x] Have you added an explanation of what your changes do and why you'd like us to include them?\r\n- [ ] Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/homebrew/pull/49031).\r\n- [x] Have you successfully run `brew tests` with your changes locally?\r\n\r\n-----\r\n\r\nIn the process of going through `test_cmd_audit.rb` (with the intention of adding some unit tests), I figured I'd try to refactor `formula_text`. I also added an assertion to `test_simple_valid_formula` (wasn't sure if it belonged in the same commit as the refactoring).\r\n\r\nDo the assertions' `msg`s need to be corrected? I left them mostly as-is. But even though they're not of critical importance, I was under the impression that they should be worded to address a situation where the assertion fails, e.g.:\r\n\r\n`assert ft.has_trailing_newline?, \"The formula should have a trailing newline\"`\r\n\r\nrather than\r\n\r\n`assert ft.has_trailing_newline?, \"The formula has a trailing newline\"`","created_at":"2016-08-11T01:16:52Z","updated_at":"2016-08-12T20:58:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a1d822d7602ff702c1b91b10f275c7c5a3e75a9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Homebrew/brew/pulls/682/commits","review_comments_url":"https://api.github.com/repos/Homebrew/brew/pulls/682/comments","review_comment_url":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Homebrew/brew/issues/682/comments","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/d355ab1ac1dc80d56e38d098b49b516f38201b91","head":{"label":"eirinikos:extend-cmd-audit-tests","ref":"extend-cmd-audit-tests","sha":"d355ab1ac1dc80d56e38d098b49b516f38201b91","user":{"login":"eirinikos","id":9170701,"avatar_url":"https://avatars.githubusercontent.com/u/9170701?v=3","gravatar_id":"","url":"https://api.github.com/users/eirinikos","html_url":"https://github.com/eirinikos","followers_url":"https://api.github.com/users/eirinikos/followers","following_url":"https://api.github.com/users/eirinikos/following{/other_user}","gists_url":"https://api.github.com/users/eirinikos/gists{/gist_id}","starred_url":"https://api.github.com/users/eirinikos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eirinikos/subscriptions","organizations_url":"https://api.github.com/users/eirinikos/orgs","repos_url":"https://api.github.com/users/eirinikos/repos","events_url":"https://api.github.com/users/eirinikos/events{/privacy}","received_events_url":"https://api.github.com/users/eirinikos/received_events","type":"User","site_admin":false},"repo":{"id":59722159,"name":"brew","full_name":"eirinikos/brew","owner":{"login":"eirinikos","id":9170701,"avatar_url":"https://avatars.githubusercontent.com/u/9170701?v=3","gravatar_id":"","url":"https://api.github.com/users/eirinikos","html_url":"https://github.com/eirinikos","followers_url":"https://api.github.com/users/eirinikos/followers","following_url":"https://api.github.com/users/eirinikos/following{/other_user}","gists_url":"https://api.github.com/users/eirinikos/gists{/gist_id}","starred_url":"https://api.github.com/users/eirinikos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eirinikos/subscriptions","organizations_url":"https://api.github.com/users/eirinikos/orgs","repos_url":"https://api.github.com/users/eirinikos/repos","events_url":"https://api.github.com/users/eirinikos/events{/privacy}","received_events_url":"https://api.github.com/users/eirinikos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eirinikos/brew","description":":beer: The missing package manager for OS X","fork":true,"url":"https://api.github.com/repos/eirinikos/brew","forks_url":"https://api.github.com/repos/eirinikos/brew/forks","keys_url":"https://api.github.com/repos/eirinikos/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eirinikos/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eirinikos/brew/teams","hooks_url":"https://api.github.com/repos/eirinikos/brew/hooks","issue_events_url":"https://api.github.com/repos/eirinikos/brew/issues/events{/number}","events_url":"https://api.github.com/repos/eirinikos/brew/events","assignees_url":"https://api.github.com/repos/eirinikos/brew/assignees{/user}","branches_url":"https://api.github.com/repos/eirinikos/brew/branches{/branch}","tags_url":"https://api.github.com/repos/eirinikos/brew/tags","blobs_url":"https://api.github.com/repos/eirinikos/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eirinikos/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eirinikos/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/eirinikos/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eirinikos/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/eirinikos/brew/languages","stargazers_url":"https://api.github.com/repos/eirinikos/brew/stargazers","contributors_url":"https://api.github.com/repos/eirinikos/brew/contributors","subscribers_url":"https://api.github.com/repos/eirinikos/brew/subscribers","subscription_url":"https://api.github.com/repos/eirinikos/brew/subscription","commits_url":"https://api.github.com/repos/eirinikos/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/eirinikos/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/eirinikos/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/eirinikos/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/eirinikos/brew/contents/{+path}","compare_url":"https://api.github.com/repos/eirinikos/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eirinikos/brew/merges","archive_url":"https://api.github.com/repos/eirinikos/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eirinikos/brew/downloads","issues_url":"https://api.github.com/repos/eirinikos/brew/issues{/number}","pulls_url":"https://api.github.com/repos/eirinikos/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/eirinikos/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/eirinikos/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eirinikos/brew/labels{/name}","releases_url":"https://api.github.com/repos/eirinikos/brew/releases{/id}","deployments_url":"https://api.github.com/repos/eirinikos/brew/deployments","created_at":"2016-05-26T05:23:22Z","updated_at":"2016-05-26T05:23:24Z","pushed_at":"2016-08-11T01:04:16Z","git_url":"git://github.com/eirinikos/brew.git","ssh_url":"git@github.com:eirinikos/brew.git","clone_url":"https://github.com/eirinikos/brew.git","svn_url":"https://github.com/eirinikos/brew","homepage":"http://brew.sh","size":10435,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Homebrew:master","ref":"master","sha":"06fe347de97975dc01e726f87bf07a56a6fb713e","user":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"repo":{"id":53238813,"name":"brew","full_name":"Homebrew/brew","owner":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Homebrew/brew","description":":beer: The missing package manager for OS X","fork":false,"url":"https://api.github.com/repos/Homebrew/brew","forks_url":"https://api.github.com/repos/Homebrew/brew/forks","keys_url":"https://api.github.com/repos/Homebrew/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Homebrew/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Homebrew/brew/teams","hooks_url":"https://api.github.com/repos/Homebrew/brew/hooks","issue_events_url":"https://api.github.com/repos/Homebrew/brew/issues/events{/number}","events_url":"https://api.github.com/repos/Homebrew/brew/events","assignees_url":"https://api.github.com/repos/Homebrew/brew/assignees{/user}","branches_url":"https://api.github.com/repos/Homebrew/brew/branches{/branch}","tags_url":"https://api.github.com/repos/Homebrew/brew/tags","blobs_url":"https://api.github.com/repos/Homebrew/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Homebrew/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Homebrew/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/Homebrew/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/Homebrew/brew/languages","stargazers_url":"https://api.github.com/repos/Homebrew/brew/stargazers","contributors_url":"https://api.github.com/repos/Homebrew/brew/contributors","subscribers_url":"https://api.github.com/repos/Homebrew/brew/subscribers","subscription_url":"https://api.github.com/repos/Homebrew/brew/subscription","commits_url":"https://api.github.com/repos/Homebrew/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/Homebrew/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/Homebrew/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/Homebrew/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/Homebrew/brew/contents/{+path}","compare_url":"https://api.github.com/repos/Homebrew/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Homebrew/brew/merges","archive_url":"https://api.github.com/repos/Homebrew/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Homebrew/brew/downloads","issues_url":"https://api.github.com/repos/Homebrew/brew/issues{/number}","pulls_url":"https://api.github.com/repos/Homebrew/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/Homebrew/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/Homebrew/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Homebrew/brew/labels{/name}","releases_url":"https://api.github.com/repos/Homebrew/brew/releases{/id}","deployments_url":"https://api.github.com/repos/Homebrew/brew/deployments","created_at":"2016-03-06T05:08:38Z","updated_at":"2016-08-12T19:39:08Z","pushed_at":"2016-08-12T20:31:39Z","git_url":"git://github.com/Homebrew/brew.git","ssh_url":"git@github.com:Homebrew/brew.git","clone_url":"https://github.com/Homebrew/brew.git","svn_url":"https://github.com/Homebrew/brew","homepage":"http://brew.sh","size":11090,"stargazers_count":2518,"watchers_count":2518,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":733,"mirror_url":null,"open_issues_count":50,"forks":733,"open_issues":50,"watchers":2518,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/682"},"html":{"href":"https://github.com/Homebrew/brew/pull/682"},"issue":{"href":"https://api.github.com/repos/Homebrew/brew/issues/682"},"comments":{"href":"https://api.github.com/repos/Homebrew/brew/issues/682/comments"},"review_comments":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/682/comments"},"review_comment":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/682/commits"},"statuses":{"href":"https://api.github.com/repos/Homebrew/brew/statuses/d355ab1ac1dc80d56e38d098b49b516f38201b91"}}}}
{"actor":{"display_login":"MikeMcQuaid"}}