Class: Solargraph::Rspec::Gems
- Inherits:
-
Object
- Object
- Solargraph::Rspec::Gems
- Defined in:
- lib/solargraph/rspec/gems.rb
Defined Under Namespace
Classes: GemHelpers
Constant Summary collapse
- GEM_HELPERS =
GemHelpers.new( required_gems: %w[rspec rspec-expectations rspec-core], helper_modules: %w[RSpec::Matchers] ), # https://github.com/rspec/rspec-mocks GemHelpers.new( required_gems: %w[rspec-mocks], helper_modules: %w[RSpec::Mocks::ExampleMethods] ), # @see https://github.com/rspec/rspec-rails#what-tests-should-i-write # @see https://github.com/rspec/rspec-rails#helpful-rails-matchers GemHelpers.new( required_gems: %w[rspec-rails actionmailer activesupport actionpack], helper_modules: [ 'RSpec::Rails::Matchers', 'ActionController::TestCase::Behavior', 'ActionMailer::TestCase::Behavior', 'ActiveSupport::Testing::Assertions', 'ActiveSupport::Testing::TimeHelpers', 'ActiveSupport::Testing::FileFixtures', 'ActiveRecord::TestFixtures', 'ActionDispatch::Integration::Runner', 'ActionDispatch::Routing::UrlFor', 'ActionController::TemplateAssertions' ] ), # @see https://matchers.shoulda.io/docs/v6.2.0/#matchers GemHelpers.new( required_gems: %w[shoulda-matchers], helper_modules: [ 'Shoulda::Matchers::ActiveModel', 'Shoulda::Matchers::ActiveRecord', 'Shoulda::Matchers::ActionController', 'Shoulda::Matchers::Routing' ] ), # @see https://github.com/wspurgin/rspec-sidekiq#matchers GemHelpers.new( required_gems: %w[rspec-sidekiq], helper_modules: %w[RSpec::Sidekiq::Matchers] ), # @see https://github.com/bblimke/webmock#examples GemHelpers.new( required_gems: %w[webmock], helper_modules: %w[WebMock::API WebMock::Matchers] ), # @see https://github.com/brooklynDev/airborne GemHelpers.new( required_gems: %w[airborne], helper_modules: %w[Airborne] ) ].freeze
Class Method Summary collapse
- .gem_names ⇒ Array<String>
- .helper_module_names ⇒ Array<String>
- .include_helper_pins(root_example_group_namespace_pin:) ⇒ Array<Pin::Reference::Include>
Class Method Details
.gem_names ⇒ Array<String>
14 15 16 |
# File 'lib/solargraph/rspec/gems.rb', line 14 def gem_names GEM_HELPERS.flat_map(&:required_gems) end |
.helper_module_names ⇒ Array<String>
19 20 21 |
# File 'lib/solargraph/rspec/gems.rb', line 19 def helper_module_names GEM_HELPERS.flat_map(&:helper_modules) end |
.include_helper_pins(root_example_group_namespace_pin:) ⇒ Array<Pin::Reference::Include>
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/solargraph/rspec/gems.rb', line 25 def include_helper_pins(root_example_group_namespace_pin:) Solargraph.logger.debug "[RSpec] adding helper modules #{helper_module_names}" helper_module_names.map do |helper_module| PinFactory.build_module_include( root_example_group_namespace_pin, helper_module, root_example_group_namespace_pin.location ) end end |