Class: RuboCop::Cop::RSpec::BeforeAfterAll
- Defined in:
- lib/rubocop/cop/rspec/before_after_all.rb
Overview
Check that before/after(:all) isn’t being used.
Constant Summary collapse
- MSG =
'Beware of using `%<hook>s` as it may cause state to leak '\ 'between tests. If you are using `rspec-rails`, and '\ '`use_transactional_fixtures` is enabled, then records created '\ 'in `%<hook>s` are not automatically rolled back.'.freeze
Constants inherited from Cop
Constants included from RSpec::Language
Instance Method Summary collapse
Methods inherited from Cop
Instance Method Details
#on_send(node) ⇒ Object
36 37 38 39 40 |
# File 'lib/rubocop/cop/rspec/before_after_all.rb', line 36 def on_send(node) before_or_after_all(node) do |hook| add_offense(node, :expression, format(MSG, hook: hook.source)) end end |