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

Instance Method Details

#environObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/solargraph/convention/rspec.rb', line 10

def environ
  @environ ||= Environ.new(
    requires: ['rspec'],
    domains: ['RSpec::Matchers', 'RSpec::ExpectationGroups'],
    # 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)
    overrides: [
      Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget')
    ]
  )
end

#match?(source) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/solargraph/convention/rspec.rb', line 6

def match? source
  File.basename(source.filename) =~ /_spec\.rb$/
end