Open
Description
Issue happened on:
dry-validation-matchers 1.2.2
Ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin21]
Rails 7.0.4.3
Gemfile depends on rspec-rails gem only and not depends on rspec-core directly
dry-validation-matchers gem was defined after rspec-rails gem
Issue trigger:
run rails c
or
run rails s -b 0.0.0.0
Error log when exception raised:
/Users/username/.rvm/gems/ruby-3.0.0/gems/dry-validation-matchers-1.2.2/lib/dry/validation/matchers/integrations/rspec.rb:2:in `<main>': undefined method `configure' for RSpec:Module (NoMethodError)
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/dry-validation-matchers-1.2.2/lib/dry/validation/matchers.rb:5:in `<main>'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/dry-validation-matchers-1.2.2/lib/dry-validation-matchers.rb:1:in `<main>'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler/runtime.rb:55:in `each'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler/runtime.rb:55:in `block in require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler/runtime.rb:44:in `each'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler/runtime.rb:44:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.23/lib/bundler.rb:187:in `require'
from /Users/username/Documents/hyrd/repo/hyrd-api/config/application.rb:7:in `<main>'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-7.0.4.2/lib/rails/commands/server/server_command.rb:137:in `block in perform'
from <internal:kernel>:90:in `tap'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-7.0.4.2/lib/rails/commands/server/server_command.rb:134:in `perform'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-7.0.4.2/lib/rails/command/base.rb:87:in `perform'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-7.0.4.2/lib/rails/command.rb:48:in `invoke'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-7.0.4.2/lib/rails/commands.rb:18:in `<main>'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/username/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from bin/rails:4:in `<main>'
Analysis:
- Based on the conditions mentioned above, the rspec-rails behavior was extending RSpec module, that makes the RSpec module defined but the configure method was not defined (ref)
Solution:
Alternative solution on this issue:
- adding rspec-core to the gemfile and defined it before dry-validation-helper
or - defining dry-validation-helper gem before rspec-rails gem
Both needs to update the README.md to avoid this issue
Metadata
Metadata
Assignees
Labels
No labels