Class: Solargraph::Rspec::Correctors::DslMethodsCorrector

Inherits:
Base
  • Object
show all
Defined in:
lib/solargraph/rspec/correctors/dsl_methods_corrector.rb

Overview

Includes DSL method helpers in the example group block for completion (ie. it, before, let, subject, etc.)

Instance Attribute Summary

Attributes inherited from Base

#added_pins, #namespace_pins, #rspec_walker

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Solargraph::Rspec::Correctors::Base

Class Method Details

.rspec_yardoc_tagsArray<YARD::CodeObjects::Base>

Returns:

  • (Array<YARD::CodeObjects::Base>)


12
13
14
15
16
17
18
19
20
# File 'lib/solargraph/rspec/correctors/dsl_methods_corrector.rb', line 12

def self.rspec_yardoc_tags
  @rspec_yardoc_tags ||= begin
    spec = Gem::Specification.find_by_name('rspec-core')
    require_paths = spec.require_paths.map { |path| File.join(spec.full_gem_path, path) }
    Solargraph.logger.debug "[RSpec] Loading YARD registry for rspec-core from #{require_paths}"
    YARD::Registry.load(require_paths, true)
    YARD::Registry.all
  end
end

Instance Method Details

#correct(_source_map) ⇒ void

This method returns an undefined value.

Parameters:

  • source_map (Solargraph::SourceMap)


24
25
26
27
28
29
30
31
# File 'lib/solargraph/rspec/correctors/dsl_methods_corrector.rb', line 24

def correct(_source_map)
  rspec_walker.after_walk do
    namespace_pins.each do |namespace_pin|
      add_pins(context_dsl_methods(namespace_pin))
      add_pins(methods_with_example_binding(namespace_pin))
    end
  end
end