Class: Solargraph::Convention::Rspec

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

Constant Summary

Constants inherited from Base

Base::EMPTY_ENVIRON

Instance Method Summary collapse

Methods inherited from Base

#global

Instance Method Details

#local(source_map) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/solargraph/convention/rspec.rb', line 6

def local source_map
  return EMPTY_ENVIRON unless File.basename(source_map.filename) =~ /_spec\.rb$/
  @environ ||= Environ.new(
    requires: ['rspec'],
    domains: ['RSpec::Matchers', 'RSpec::ExpectationGroups'],
    pins: [
      # This override is necessary due to an erroneous @return tag in
      # rspec's YARD documentation.
      # @todo The return types have been fixed (https://github.com/rspec/rspec-expectations/pull/1121)
      Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget')
    ].concat(extras)
  )
end