Class: Solargraph::Rspec::Correctors::ExampleAndHookBlocksBindingCorrector
- Inherits:
-
WalkerBase
- Object
- Base
- WalkerBase
- Solargraph::Rspec::Correctors::ExampleAndHookBlocksBindingCorrector
- Defined in:
- lib/solargraph/rspec/correctors/example_and_hook_blocks_binding_corrector.rb
Overview
Sets the correct namespace binding for example group blocks (it, example, etc.) and hook blocks (before, after, around)
Instance Attribute Summary
Attributes inherited from WalkerBase
#namespace_pins, #rspec_walker
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from WalkerBase
Methods inherited from Base
Constructor Details
This class inherits a constructor from Solargraph::Rspec::Correctors::WalkerBase
Instance Method Details
#correct(source_map) ⇒ void
This method returns an undefined value.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/solargraph/rspec/correctors/example_and_hook_blocks_binding_corrector.rb', line 13 def correct(source_map) rspec_walker.on_example_block do |location_range| bind_closest_namespace(location_range, source_map) yield [] if block_given? end rspec_walker.on_hook_block do |location_range| bind_closest_namespace(location_range, source_map) yield [] if block_given? end rspec_walker.on_let_method do |_method_name, location_range| bind_closest_namespace(location_range, source_map) yield [] if block_given? end rspec_walker.on_blocks_in_examples do |location_range| bind_closest_namespace(location_range, source_map) yield [] if block_given? end rspec_walker.on_subject do |_method_name, location_range| bind_closest_namespace(location_range, source_map) yield [] if block_given? end end |