Class: RuboCop::Cop::RSpec::Rails::AvoidSetupHook

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb

Overview

Checks that tests use RSpec ‘before` hook over Rails `setup` method.

Examples:

# bad
setup do
  allow(foo).to receive(:bar)
end

# good
before do
  allow(foo).to receive(:bar)
end

Method Summary

Methods inherited from Base

inherited, #on_new_investigation

Methods included from RSpec::Language::NodePattern

#block_or_numblock_pattern, #block_pattern, #numblock_pattern, #send_pattern

Methods included from RSpec::Language

#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?