{"action":"created","issue":{"url":"https://api.github.com/repos/rspec/rspec-core/issues/1941","labels_url":"https://api.github.com/repos/rspec/rspec-core/issues/1941/labels{/name}","comments_url":"https://api.github.com/repos/rspec/rspec-core/issues/1941/comments","events_url":"https://api.github.com/repos/rspec/rspec-core/issues/1941/events","html_url":"https://github.com/rspec/rspec-core/issues/1941","id":69645000,"number":1941,"title":"Failure filtering runs all examples when there are no failures","user":{"login":"myronmarston","id":49391,"avatar_url":"https://avatars.githubusercontent.com/u/49391?v=3","gravatar_id":"","url":"https://api.github.com/users/myronmarston","html_url":"https://github.com/myronmarston","followers_url":"https://api.github.com/users/myronmarston/followers","following_url":"https://api.github.com/users/myronmarston/following{/other_user}","gists_url":"https://api.github.com/users/myronmarston/gists{/gist_id}","starred_url":"https://api.github.com/users/myronmarston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myronmarston/subscriptions","organizations_url":"https://api.github.com/users/myronmarston/orgs","repos_url":"https://api.github.com/users/myronmarston/repos","events_url":"https://api.github.com/users/myronmarston/events{/privacy}","received_events_url":"https://api.github.com/users/myronmarston/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rspec/rspec-core/labels/small","name":"small","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-20T17:59:30Z","updated_at":"2015-04-27T14:41:09Z","closed_at":"2015-04-27T14:41:09Z","body":"When you have `config.run_all_when_everything_filtered = true` set and you use `--only-failures` or `--next-failure` and there are no failures in the persistence file, the current behavior is to run _all_ examples.  This is counterintuitive because you've told RSpec to run only failures but instead it runs only successes (which happens to be all examples).  This is a consequence of the fact that failure filtering is implemented using the general filtering mechanism, and `run_all_when_everything_filtered` kicks in in this case.\r\n\r\nIdeally, if you used `--only-failures` or `--next-failure` and there were none, RSpec would abort quickly with a message stating there are no failures.  If we do that, one open question is what status code to use: on the one hand, the command kinda failed (it failed to find any failures to run) so maybe it should be non-zero.  Also, exiting with a zero status code when no examples were even run seems potentially problematic.  OTOH, I could see someone repeatedly running `rspec --next-failure && say \"done\"` (or similar -- idea inspired by [this tweet](https://twitter.com/pragdave/status/570774584695218176)), and for this use case it would be important for RSpec to exit with a 0 status when it hits a point where there are no more failures to run.\r\n\r\nThoughts on what status code should be used for this?\r\n\r\nWe're also discussing phasing out `run_all_when_everything_filtered` in #1920 in favor of a new `ignore_unmatched_filters` option, so that should be taken into account for whatever solution we decide upon.\r\n\r\n/cc @rspec/rspec "},"comment":{"url":"https://api.github.com/repos/rspec/rspec-core/issues/comments/96679601","html_url":"https://github.com/rspec/rspec-core/issues/1941#issuecomment-96679601","issue_url":"https://api.github.com/repos/rspec/rspec-core/issues/1941","id":96679601,"user":{"login":"myronmarston","id":49391,"avatar_url":"https://avatars.githubusercontent.com/u/49391?v=3","gravatar_id":"","url":"https://api.github.com/users/myronmarston","html_url":"https://github.com/myronmarston","followers_url":"https://api.github.com/users/myronmarston/followers","following_url":"https://api.github.com/users/myronmarston/following{/other_user}","gists_url":"https://api.github.com/users/myronmarston/gists{/gist_id}","starred_url":"https://api.github.com/users/myronmarston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myronmarston/subscriptions","organizations_url":"https://api.github.com/users/myronmarston/orgs","repos_url":"https://api.github.com/users/myronmarston/repos","events_url":"https://api.github.com/users/myronmarston/events{/privacy}","received_events_url":"https://api.github.com/users/myronmarston/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T14:41:09Z","updated_at":"2015-04-27T14:41:09Z","body":"Addressed by #1945."}}