rspec config before and after blocks are ran only on the first spec invocation
Opened this issue · 1 comments
maca commented
config before suite, before each, and after each are ignored, when re running the specs. I think that rspec defines an anonymous class, my guess is that it has something with that.
RSpec.configure do |config|
config.before :suite do
puts 'Before suite'
end
config.before :each do
puts 'Before each'
end
config.after :each do
puts 'After each'
end
end
When running:
> irspec 'spec/models'
Before suite
Before each
.Before each
After each
.Before each
After each
.> irspec 'spec/models'
..
ctimmerm commented
This is actually because of a change in RSpec 2.10.1, which causes RSpec.reset
to correctly reset the configuration, including all defined before/after hooks.