jsonapi-rb / jsonapi-rspec

RSpec matchers for JSON:API spec
https://rubygems.org/gems/jsonapi-rspec
MIT License
123 stars 24 forks source link

v0.0.5 configure for jsonapi_indifferent_hash breaking rake spec #20

Closed sa73917 closed 4 years ago

sa73917 commented 4 years ago

Expected Behavior

jsonapi-rspec gem should load within rake without issues

Actual Behavior

rake aborted!
NoMethodError: undefined method `configure' for RSpec:Module
.../config/application.rb:20:in `<top (required)>'
.../Rakefile:4:in `require_relative'
.../Rakefile:4:in `<top (required)>'

Caused by:
LoadError: cannot load such file -- jsonapi-rspec
.../config/application.rb:20:in `<top (required)>'
.../Rakefile:4:in `require_relative'
.../Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

Steps to Reproduce the Problem

  1. include v0.0.5 in project Gemfile
  2. run rake spec

Specifications

Possible solution

requiring rspec/core in rspec.rb resolves the issue. Not sure if this is the best solution but certainly a simple fix.

stas commented 4 years ago

Hmm, could it be because of this: https://github.com/jsonapi-rb/jsonapi-rspec/blob/master/lib/jsonapi/rspec.rb#L11-L13

Could you please open a PR please.

sa73917 commented 4 years ago

Yes its definitely those lines of code - it's just rake is being a bit eager trying to load the gem before the RSpec:Core module is there...

Not sure if there's a better way but this PR resolves the issue

stas commented 4 years ago

Fixed in #21

stas commented 4 years ago

Thank you @sa73917!