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.'
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
RSpec::Language::ALL, RSpec::Language::RSPEC
Instance Method Summary collapse
Methods inherited from Cop
Instance Method Details
#on_send(node) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# 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, location: :expression, message: format(MSG, hook: hook.source) ) end end |