is it possible to check if a module is already included in rspec configuration?

A workaround solution. @include_modules contains an instance of RSpec::Core::FilterableItemRepository::QueryOptimized which has items_and_filters method.

RSpec.configure do |config|
  included_modules = RSpec.configuration.instance_variable_get(:@include_modules)
  unless included_modules.include?(MyMod)
    config.include MyMod
> RSpec.configuration.instance_variable_get(:@include_modules).items_and_filters
=> [[MyMod, {}]]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top