class RuboCop::Cop::RSpec::BeforeAfterAll
Check that before/after(:all/:context) isn’t being used.
@example
# bad - Faster but risk of state leaking between examples describe MyClass do before(:all) { Widget.create } after(:context) { Widget.delete_all } end # good - Slower but examples are properly isolated describe MyClass do before(:each) { Widget.create } after(:each) { Widget.delete_all } end
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/rspec/before_after_all.rb, line 34 def on_send(node) before_or_after_all(node) do |hook| add_offense( node, message: format(MSG, hook: hook.source) ) end end