You can clone with
It resets example_groups, but not shared ones. I reckon a fix is to just add a line to World.reset to clear it. Does that seem right? Should I submit a pull request for that?
Thanks, but shared_example_groups doesn't need to be cleared :)
Ah, I should describe my use case more.
So it only doesn't need to be cleared if you assume that the Ruby runtime will only be initialized once in the program. However, because of the slow startup time in JRuby, we use a single VM and run RSpec multiple times in that VM by calling RSpec::Core::Runner.run. Perhaps there's a better way to use RSpec?
This use case is why example_groups.clear exists. Even with multiple runs, clearing shared_example_groups would have no affect on your expectations, right?
With multiple runs, I get an error like "Shared example group 'an email' already exists". Clearing shared_example_groups fixes that.
Ahhhh I forgot about that check. Pushing a fix.
Closed by rspec/rspec-core@8e8fb2b