Skip to content
This repository was archived by the owner on Jun 11, 2022. It is now read-only.
This repository was archived by the owner on Jun 11, 2022. It is now read-only.

undefined method `configure' for RSpec:Module (with Spring and Bundler.require) #12

@Justin-Maxwell

Description

@Justin-Maxwell

[nb: workaround is simply gem 'jsonapi-resources-matchers', :require => false]

Using RubyMine, with Spring, and Bundler.require in application.rb

There was an error while trying to load the gem 'jsonapi-resources-matchers'. 
Gem Load Error is: undefined method `configure' for RSpec:Module

As near as I can tell: When jsonapi-resources-matchers is loaded by Bundler.require, lib/jsonapi/resources/matchers/integrations/rspec.rb checks to see if RSpec is defined before calling Rspec.configure, but I'm guessing RSpec.configure is dynamically created, and not necessarily at load time.

Adding the second line here:

if defined?(RSpec)
  puts 'RSpec: ', defined?(RSpec) || 'nope', '.configure: ', defined?(RSpec.configure) || 'nope'
  RSpec.configure do |c|
    c.include JSONAPI::Resources::Matchers, type: :resource
  end
end

with Spring enabled, outputs:

RSpec: 
constant
.configure: 
nope

and without Spring:

RSpec: 
constant
.configure: 
method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions