Class: Solargraph::Rspec::TestHelpers
- Inherits:
-
Object
- Object
- Solargraph::Rspec::TestHelpers
- Defined in:
- lib/solargraph/rspec/test_helpers.rb
Defined Under Namespace
Classes: GemHelpers
Constant Summary collapse
- GEM_HELPERS =
GemHelpers.new( required_gems: %w[rspec], 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 activerecord], 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
Instance Attribute Summary collapse
- #helper_modules ⇒ Array<String> readonly
- #required_gems ⇒ Array<String> readonly
Class Method Summary collapse
- .gem_names ⇒ String
- .helper_module_names ⇒ Array<String>
- .include_helper_pins(root_example_group_namespace_pin:) ⇒ Array<Pin::Reference::Include>
Instance Attribute Details
#helper_modules ⇒ Array<String> (readonly)
|
# File 'lib/solargraph/rspec/test_helpers.rb', line 7
|
#required_gems ⇒ Array<String> (readonly)
|
# File 'lib/solargraph/rspec/test_helpers.rb', line 7
|
Class Method Details
.gem_names ⇒ String
15 16 17 |
# File 'lib/solargraph/rspec/test_helpers.rb', line 15 def gem_names GEM_HELPERS.flat_map(&:required_gems) end |
.helper_module_names ⇒ Array<String>
20 21 22 |
# File 'lib/solargraph/rspec/test_helpers.rb', line 20 def helper_module_names GEM_HELPERS.flat_map(&:helper_modules) end |
.include_helper_pins(root_example_group_namespace_pin:) ⇒ Array<Pin::Reference::Include>
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/solargraph/rspec/test_helpers.rb', line 26 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 |