{"action":"created","issue":{"url":"https://api.github.com/repos/rspec/rspec-core/issues/2367","repository_url":"https://api.github.com/repos/rspec/rspec-core","labels_url":"https://api.github.com/repos/rspec/rspec-core/issues/2367/labels{/name}","comments_url":"https://api.github.com/repos/rspec/rspec-core/issues/2367/comments","events_url":"https://api.github.com/repos/rspec/rspec-core/issues/2367/events","html_url":"https://github.com/rspec/rspec-core/issues/2367","id":200618895,"number":2367,"title":"RSpec clear_examples almost works in a complex setup with Runner.run in a loop.","user":{"login":"guyboertje","id":84912,"avatar_url":"https://avatars.githubusercontent.com/u/84912?v=3","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-13T12:27:55Z","updated_at":"2017-01-14T16:10:07Z","closed_at":null,"body":"In the [Logstash](https://github.com/elastic/logstash) product we use rake and rspec to run many specs on the main project and the 100 or so plugins that have their own rspec suite.\r\n\r\nWe thank the rspec community for their continued work on this important library.\r\n\r\nWhen run individually each plugin spec suite runs fine with the set of helpers required correctly.\r\n\r\nIf I attempt to automate these with a loop using `RSpec::Core::Runner.run(rspec_args)` and `RSpec.clear_examples` it almost works.\r\n\r\n1) the deprecation warnings are not cleared and continue to be reported in a cumulative manner (i know but we have tech debt and a smallish team). I was able to use `--deprecation-out` to reduce the output in the console.\r\n2) the shared_examples from `require ..../shared_examples` are removed by the `world.reset` method doing `@shared_example_group_registry = nil` NOTE: commenting this line out worked for me.\r\n3) the `--out` setting did not work because the IO is closed after the first loop iteration and `clear_examples` does not reopen the IO. I had to pipe the stdout output to a file.\r\n\r\nIt is important in our case to have the output go to a file because with JRuby stack traces etc. we can't always scroll back in the console.\r\n\r\nIt is debatable whether the randomized seed should be reset by `clear_examples`.\r\n\r\nI tried to change some code with an eye to a PR (its always nice to get fixes with issues, we know) but the finding of how to clear the calls in the `DeprecationReporterBuffer` defeated me. \r\n\r\nMay I suggest a method called something like `reset_before_rerun` that is `clear_examples` and more? It would better reveal the intention of the functionality.\r\n\r\nPrevious discussion - https://github.com/rspec/rspec-core/issues/1700"},"comment":{"url":"https://api.github.com/repos/rspec/rspec-core/issues/comments/272633553","html_url":"https://github.com/rspec/rspec-core/issues/2367#issuecomment-272633553","issue_url":"https://api.github.com/repos/rspec/rspec-core/issues/2367","id":272633553,"user":{"login":"xaviershay","id":1714,"avatar_url":"https://avatars.githubusercontent.com/u/1714?v=3","gravatar_id":"","url":"https://api.github.com/users/xaviershay","html_url":"https://github.com/xaviershay","followers_url":"https://api.github.com/users/xaviershay/followers","following_url":"https://api.github.com/users/xaviershay/following{/other_user}","gists_url":"https://api.github.com/users/xaviershay/gists{/gist_id}","starred_url":"https://api.github.com/users/xaviershay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xaviershay/subscriptions","organizations_url":"https://api.github.com/users/xaviershay/orgs","repos_url":"https://api.github.com/users/xaviershay/repos","events_url":"https://api.github.com/users/xaviershay/events{/privacy}","received_events_url":"https://api.github.com/users/xaviershay/received_events","type":"User","site_admin":false},"created_at":"2017-01-14T16:10:07Z","updated_at":"2017-01-14T16:10:07Z","body":"Could you please link up an example of your current usage? I can't seem to find it :(\r\n\r\nJust to check, `RSpec.reset` doesn't do what you want, right? Presumably because you want to preserve configuration."}}
{"actor":{"display_login":"xaviershay"}}