Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

RSpec.world.reset does not reset shared_example_groups #27

Closed
pbiggar opened this Issue January 24, 2012 · 6 comments

2 participants

Paul Biggar Justin Ko
Paul Biggar

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?

Justin Ko

Thanks, but shared_example_groups doesn't need to be cleared :)

Justin Ko justinko closed this January 24, 2012
Paul Biggar

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?

Justin Ko

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?

Paul Biggar

With multiple runs, I get an error like "Shared example group 'an email' already exists". Clearing shared_example_groups fixes that.

Justin Ko

Ahhhh I forgot about that check. Pushing a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.