brainspec / enumerize

Enumerated attributes with I18n and ActiveRecord/Mongoid support
MIT License
1.73k stars 190 forks source link

conflict/raise errors when used with rspec-sqlimit #418

Closed kivanio closed 1 year ago

kivanio commented 1 year ago

The new version conflict/raise errors when used with: https://github.com/nepalez/rspec-sqlimit

Probably because this change:https://github.com/brainspec/enumerize/commit/28dd2247ec03ef9a7e74266060d443ed8df1c2b4

But It looks weird at first look It seems that should not happen 🤔

Downgrade to 2.5.0 fix the loading.

/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rspec-sqlimit-0.0.5/lib/rspec/sqlimit.rb:11:in `<module:RSpec>': undefined method `define' for RSpec::Matchers:Module (NoMethodError)
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rspec-sqlimit-0.0.5/lib/rspec/sqlimit.rb:5:in `<main>'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rspec-sqlimit-0.0.5/lib/rspec-sqlimit.rb:1:in `require_relative'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rspec-sqlimit-0.0.5/lib/rspec-sqlimit.rb:1:in `<main>'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/runtime.rb:55:in `each'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/runtime.rb:55:in `block in require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/runtime.rb:44:in `each'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/runtime.rb:44:in `require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler.rb:195:in `require'
    from /Users/kivanio/projetos/kobana/boletosimples-app/config/application.rb:22:in `<top (required)>'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application.rb:92:in `preload'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application.rb:166:in `serve'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application.rb:148:in `block in run'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application.rb:142:in `loop'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application.rb:142:in `run'
    from /Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spring-4.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
    from <internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
    from -e:1:in `<main>'
nashby commented 1 year ago

@kivanio hey! can't really reproduce it in a new app. Could you please send simple application that reproduces it so I can take a look? Thanks!

kivanio commented 1 year ago

@nashby here is a fresh app with the issue. https://github.com/kivanio/enumerize-test-app

I can not even run the migrations:

➜ enumerize-test-app (main) ✗ bin/rails db:migrate RAILS_ENV=test
rails aborted!
NoMethodError: undefined method `define' for RSpec::Matchers:Module
<internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/Users/kivanio/projetos/kivanio/enumerize-test-app/config/application.rb:7:in `<main>'
/Users/kivanio/projetos/kivanio/enumerize-test-app/Rakefile:4:in `require_relative'
/Users/kivanio/projetos/kivanio/enumerize-test-app/Rakefile:4:in `<main>'
<internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/Users/kivanio/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
nashby commented 1 year ago

@kivanio thanks! Could you please test master branch and report back? It should be fixed.

kivanio commented 1 year ago

@nashby It works at the test app. Thank you 👍🏻

nashby commented 1 year ago

2.6.1 has been released with a fix!