{"action":"created","comment":{"url":"https://api.github.com/repos/rspec/rspec-core/pulls/comments/35235906","id":35235906,"diff_hunk":"@@ -244,3 +244,186 @@ Feature: filters\n       .after context\n       \"\"\"\n \n+  Scenario: Filtering hooks using symbols","path":"features/hooks/filtering.feature","position":4,"original_position":4,"commit_id":"9ef55dbd6df27749908822480fe849f7baf1fc30","original_commit_id":"9ef55dbd6df27749908822480fe849f7baf1fc30","user":{"login":"tmertens","id":2243386,"avatar_url":"https://avatars.githubusercontent.com/u/2243386?v=3","gravatar_id":"","url":"https://api.github.com/users/tmertens","html_url":"https://github.com/tmertens","followers_url":"https://api.github.com/users/tmertens/followers","following_url":"https://api.github.com/users/tmertens/following{/other_user}","gists_url":"https://api.github.com/users/tmertens/gists{/gist_id}","starred_url":"https://api.github.com/users/tmertens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmertens/subscriptions","organizations_url":"https://api.github.com/users/tmertens/orgs","repos_url":"https://api.github.com/users/tmertens/repos","events_url":"https://api.github.com/users/tmertens/events{/privacy}","received_events_url":"https://api.github.com/users/tmertens/received_events","type":"User","site_admin":false},"body":"This is to flesh out the cuke.  Not having specific examples here made these filters a (previously) hidden gem of rspec, which are very cool and powerful.  I added the documentation I wish I had when we first started using these filters.","created_at":"2015-07-22T16:55:51Z","updated_at":"2015-07-22T16:55:51Z","html_url":"https://github.com/rspec/rspec-core/pull/2035#discussion_r35235906","pull_request_url":"https://api.github.com/repos/rspec/rspec-core/pulls/2035","_links":{"self":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/comments/35235906"},"html":{"href":"https://github.com/rspec/rspec-core/pull/2035#discussion_r35235906"},"pull_request":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/2035"}}},"pull_request":{"url":"https://api.github.com/repos/rspec/rspec-core/pulls/2035","id":40577421,"html_url":"https://github.com/rspec/rspec-core/pull/2035","diff_url":"https://github.com/rspec/rspec-core/pull/2035.diff","patch_url":"https://github.com/rspec/rspec-core/pull/2035.patch","issue_url":"https://api.github.com/repos/rspec/rspec-core/issues/2035","number":2035,"state":"open","locked":false,"title":"Add ability to filter hooks via simple keys.","user":{"login":"tmertens","id":2243386,"avatar_url":"https://avatars.githubusercontent.com/u/2243386?v=3","gravatar_id":"","url":"https://api.github.com/users/tmertens","html_url":"https://github.com/tmertens","followers_url":"https://api.github.com/users/tmertens/followers","following_url":"https://api.github.com/users/tmertens/following{/other_user}","gists_url":"https://api.github.com/users/tmertens/gists{/gist_id}","starred_url":"https://api.github.com/users/tmertens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmertens/subscriptions","organizations_url":"https://api.github.com/users/tmertens/orgs","repos_url":"https://api.github.com/users/tmertens/repos","events_url":"https://api.github.com/users/tmertens/events{/privacy}","received_events_url":"https://api.github.com/users/tmertens/received_events","type":"User","site_admin":false},"body":"Also, add feature spec documentation for various filter types.\r\n\r\n\r\nThis resolves a pain point for me, where we want to create conditional before/after/around blocks that run if a key is set on an example with any value.  Previously, in order to handle any possible value, we had to provide a Proc which evaluates to true for this to work.  This PR adds the ability to simply specify the key as a filter, and if it exists in the metadata hash, it will run the block (provided no other filters filter it out).\r\n\r\nFor example, suppose we want to timecop an entire example to a specified date/time.  Previously, this would require a Proc to handle evaluation of the metadata value in order to make the block run:\r\n\r\n```ruby\r\nconfig.around(:example, travel: ->(date_time) { date_time.present? }) do |example|\r\n  Timecop.travel example.metadata[:travel] do\r\n    example.run\r\n  end\r\nend\r\n```\r\n\r\nThis PR makes this scenario simpler and more efficient due to not having to evaluate a Proc for every example containing the specified key:\r\n\r\n```ruby\r\nconfig.around(:example, :travel) do |example|\r\n  Timecop.travel example.metadata[:travel] do\r\n    example.run\r\n  end\r\nend\r\n```\r\n\r\nI also added feature specs for all of the filter types, except `:location` and `:ids`, which seem to be more specific to the CLI.  These various options were previously undocumented and only apparent if you actually read through the `Core::MetadataFilter` class or tests.\r\n\r\nNecessary Changes:\r\n- Add a filter for when only a key is provided.\r\n- Minor refactor of `Core::MetadataFilter#filter_applies?` to satisfy rubocop, and satisfy this feature.\r\n- Add tests!\r\n\r\nAll previously existing tests pass without modification, so this should be a backwards compatible feature.","created_at":"2015-07-22T15:26:04Z","updated_at":"2015-07-22T16:55:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3a366f0827be5c2309596b193439819c3c4702a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rspec/rspec-core/pulls/2035/commits","review_comments_url":"https://api.github.com/repos/rspec/rspec-core/pulls/2035/comments","review_comment_url":"https://api.github.com/repos/rspec/rspec-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rspec/rspec-core/issues/2035/comments","statuses_url":"https://api.github.com/repos/rspec/rspec-core/statuses/9ef55dbd6df27749908822480fe849f7baf1fc30","head":{"label":"avantcredit:simple_key_filtering","ref":"simple_key_filtering","sha":"9ef55dbd6df27749908822480fe849f7baf1fc30","user":{"login":"avantcredit","id":2895811,"avatar_url":"https://avatars.githubusercontent.com/u/2895811?v=3","gravatar_id":"","url":"https://api.github.com/users/avantcredit","html_url":"https://github.com/avantcredit","followers_url":"https://api.github.com/users/avantcredit/followers","following_url":"https://api.github.com/users/avantcredit/following{/other_user}","gists_url":"https://api.github.com/users/avantcredit/gists{/gist_id}","starred_url":"https://api.github.com/users/avantcredit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avantcredit/subscriptions","organizations_url":"https://api.github.com/users/avantcredit/orgs","repos_url":"https://api.github.com/users/avantcredit/repos","events_url":"https://api.github.com/users/avantcredit/events{/privacy}","received_events_url":"https://api.github.com/users/avantcredit/received_events","type":"Organization","site_admin":false},"repo":{"id":39480105,"name":"rspec-core","full_name":"avantcredit/rspec-core","owner":{"login":"avantcredit","id":2895811,"avatar_url":"https://avatars.githubusercontent.com/u/2895811?v=3","gravatar_id":"","url":"https://api.github.com/users/avantcredit","html_url":"https://github.com/avantcredit","followers_url":"https://api.github.com/users/avantcredit/followers","following_url":"https://api.github.com/users/avantcredit/following{/other_user}","gists_url":"https://api.github.com/users/avantcredit/gists{/gist_id}","starred_url":"https://api.github.com/users/avantcredit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avantcredit/subscriptions","organizations_url":"https://api.github.com/users/avantcredit/orgs","repos_url":"https://api.github.com/users/avantcredit/repos","events_url":"https://api.github.com/users/avantcredit/events{/privacy}","received_events_url":"https://api.github.com/users/avantcredit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avantcredit/rspec-core","description":"RSpec runner and formatters","fork":true,"url":"https://api.github.com/repos/avantcredit/rspec-core","forks_url":"https://api.github.com/repos/avantcredit/rspec-core/forks","keys_url":"https://api.github.com/repos/avantcredit/rspec-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avantcredit/rspec-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avantcredit/rspec-core/teams","hooks_url":"https://api.github.com/repos/avantcredit/rspec-core/hooks","issue_events_url":"https://api.github.com/repos/avantcredit/rspec-core/issues/events{/number}","events_url":"https://api.github.com/repos/avantcredit/rspec-core/events","assignees_url":"https://api.github.com/repos/avantcredit/rspec-core/assignees{/user}","branches_url":"https://api.github.com/repos/avantcredit/rspec-core/branches{/branch}","tags_url":"https://api.github.com/repos/avantcredit/rspec-core/tags","blobs_url":"https://api.github.com/repos/avantcredit/rspec-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avantcredit/rspec-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avantcredit/rspec-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/avantcredit/rspec-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avantcredit/rspec-core/statuses/{sha}","languages_url":"https://api.github.com/repos/avantcredit/rspec-core/languages","stargazers_url":"https://api.github.com/repos/avantcredit/rspec-core/stargazers","contributors_url":"https://api.github.com/repos/avantcredit/rspec-core/contributors","subscribers_url":"https://api.github.com/repos/avantcredit/rspec-core/subscribers","subscription_url":"https://api.github.com/repos/avantcredit/rspec-core/subscription","commits_url":"https://api.github.com/repos/avantcredit/rspec-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/avantcredit/rspec-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/avantcredit/rspec-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/avantcredit/rspec-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/avantcredit/rspec-core/contents/{+path}","compare_url":"https://api.github.com/repos/avantcredit/rspec-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avantcredit/rspec-core/merges","archive_url":"https://api.github.com/repos/avantcredit/rspec-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avantcredit/rspec-core/downloads","issues_url":"https://api.github.com/repos/avantcredit/rspec-core/issues{/number}","pulls_url":"https://api.github.com/repos/avantcredit/rspec-core/pulls{/number}","milestones_url":"https://api.github.com/repos/avantcredit/rspec-core/milestones{/number}","notifications_url":"https://api.github.com/repos/avantcredit/rspec-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avantcredit/rspec-core/labels{/name}","releases_url":"https://api.github.com/repos/avantcredit/rspec-core/releases{/id}","created_at":"2015-07-22T02:06:20Z","updated_at":"2015-07-22T02:06:22Z","pushed_at":"2015-07-22T15:10:28Z","git_url":"git://github.com/avantcredit/rspec-core.git","ssh_url":"git@github.com:avantcredit/rspec-core.git","clone_url":"https://github.com/avantcredit/rspec-core.git","svn_url":"https://github.com/avantcredit/rspec-core","homepage":"http://relishapp.com/rspec/rspec-core","size":24101,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"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":"rspec:master","ref":"master","sha":"561cce6fc0f26ca50e1fe6db3ff3311103ff5f1e","user":{"login":"rspec","id":22388,"avatar_url":"https://avatars.githubusercontent.com/u/22388?v=3","gravatar_id":"","url":"https://api.github.com/users/rspec","html_url":"https://github.com/rspec","followers_url":"https://api.github.com/users/rspec/followers","following_url":"https://api.github.com/users/rspec/following{/other_user}","gists_url":"https://api.github.com/users/rspec/gists{/gist_id}","starred_url":"https://api.github.com/users/rspec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rspec/subscriptions","organizations_url":"https://api.github.com/users/rspec/orgs","repos_url":"https://api.github.com/users/rspec/repos","events_url":"https://api.github.com/users/rspec/events{/privacy}","received_events_url":"https://api.github.com/users/rspec/received_events","type":"Organization","site_admin":false},"repo":{"id":238972,"name":"rspec-core","full_name":"rspec/rspec-core","owner":{"login":"rspec","id":22388,"avatar_url":"https://avatars.githubusercontent.com/u/22388?v=3","gravatar_id":"","url":"https://api.github.com/users/rspec","html_url":"https://github.com/rspec","followers_url":"https://api.github.com/users/rspec/followers","following_url":"https://api.github.com/users/rspec/following{/other_user}","gists_url":"https://api.github.com/users/rspec/gists{/gist_id}","starred_url":"https://api.github.com/users/rspec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rspec/subscriptions","organizations_url":"https://api.github.com/users/rspec/orgs","repos_url":"https://api.github.com/users/rspec/repos","events_url":"https://api.github.com/users/rspec/events{/privacy}","received_events_url":"https://api.github.com/users/rspec/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rspec/rspec-core","description":"RSpec runner and formatters","fork":false,"url":"https://api.github.com/repos/rspec/rspec-core","forks_url":"https://api.github.com/repos/rspec/rspec-core/forks","keys_url":"https://api.github.com/repos/rspec/rspec-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rspec/rspec-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rspec/rspec-core/teams","hooks_url":"https://api.github.com/repos/rspec/rspec-core/hooks","issue_events_url":"https://api.github.com/repos/rspec/rspec-core/issues/events{/number}","events_url":"https://api.github.com/repos/rspec/rspec-core/events","assignees_url":"https://api.github.com/repos/rspec/rspec-core/assignees{/user}","branches_url":"https://api.github.com/repos/rspec/rspec-core/branches{/branch}","tags_url":"https://api.github.com/repos/rspec/rspec-core/tags","blobs_url":"https://api.github.com/repos/rspec/rspec-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rspec/rspec-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rspec/rspec-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/rspec/rspec-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rspec/rspec-core/statuses/{sha}","languages_url":"https://api.github.com/repos/rspec/rspec-core/languages","stargazers_url":"https://api.github.com/repos/rspec/rspec-core/stargazers","contributors_url":"https://api.github.com/repos/rspec/rspec-core/contributors","subscribers_url":"https://api.github.com/repos/rspec/rspec-core/subscribers","subscription_url":"https://api.github.com/repos/rspec/rspec-core/subscription","commits_url":"https://api.github.com/repos/rspec/rspec-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/rspec/rspec-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/rspec/rspec-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/rspec/rspec-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/rspec/rspec-core/contents/{+path}","compare_url":"https://api.github.com/repos/rspec/rspec-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rspec/rspec-core/merges","archive_url":"https://api.github.com/repos/rspec/rspec-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rspec/rspec-core/downloads","issues_url":"https://api.github.com/repos/rspec/rspec-core/issues{/number}","pulls_url":"https://api.github.com/repos/rspec/rspec-core/pulls{/number}","milestones_url":"https://api.github.com/repos/rspec/rspec-core/milestones{/number}","notifications_url":"https://api.github.com/repos/rspec/rspec-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rspec/rspec-core/labels{/name}","releases_url":"https://api.github.com/repos/rspec/rspec-core/releases{/id}","created_at":"2009-06-29T15:41:05Z","updated_at":"2015-07-20T20:38:17Z","pushed_at":"2015-07-22T15:26:05Z","git_url":"git://github.com/rspec/rspec-core.git","ssh_url":"git@github.com:rspec/rspec-core.git","clone_url":"https://github.com/rspec/rspec-core.git","svn_url":"https://github.com/rspec/rspec-core","homepage":"http://relishapp.com/rspec/rspec-core","size":24101,"stargazers_count":682,"watchers_count":682,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":486,"mirror_url":null,"open_issues_count":27,"forks":486,"open_issues":27,"watchers":682,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/2035"},"html":{"href":"https://github.com/rspec/rspec-core/pull/2035"},"issue":{"href":"https://api.github.com/repos/rspec/rspec-core/issues/2035"},"comments":{"href":"https://api.github.com/repos/rspec/rspec-core/issues/2035/comments"},"review_comments":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/2035/comments"},"review_comment":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/2035/commits"},"statuses":{"href":"https://api.github.com/repos/rspec/rspec-core/statuses/9ef55dbd6df27749908822480fe849f7baf1fc30"}}}}