Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Сheck name only for Mongoid::Documents classes in Mongoid adapter #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dem
Copy link

@dem dem commented Aug 28, 2024

Pickle fail to load together with faker gem (version 3.4.2)

$ bundle exec cucumber
Running Tests
missing keywords: :size, :region (ArgumentError)
/usr/share/rvm/gems/ruby-3.3.4/gems/faker-3.4.2/lib/faker/travel/airport.rb:20:in `name'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapters/mongoid.rb:16:in `block in model_classes'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapters/mongoid.rb:15:in `select'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapters/mongoid.rb:15:in `model_classes'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapter.rb:52:in `block in model_classes'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapter.rb:52:in `map'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/adapter.rb:52:in `model_classes'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/config.rb:28:in `predicates'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/parser/matchers.rb:61:in `match_predicate'
(eval at/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/parser/matchers.rb:66):2:in `capture_predicate'
/usr/share/rvm/gems/ruby-3.3.4/gems/pickle-0.9.0/lib/pickle/world.rb:13:in `capture_predicate'
...
/usr/share/rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
/usr/share/rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
/usr/share/rvm/gems/ruby-3.3.4/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/usr/share/rvm/gems/ruby-3.3.4/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/glue/registry_and_more.rb:124:in `load_code_file'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime/support_code.rb:145:in `load_file'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime/support_code.rb:81:in `each'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime.rb:274:in `load_step_definitions'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/runtime.rb:74:in `run!'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/lib/cucumber/cli/main.rb:29:in `execute!'
/usr/share/rvm/gems/ruby-3.3.4/gems/cucumber-9.2.0/bin/cucumber:9:in `<top (required)>'
/usr/share/rvm/gems/ruby-3.3.4/bin/cucumber:25:in `load'
/usr/share/rvm/gems/ruby-3.3.4/bin/cucumber:25:in `<main>'
/usr/share/rvm/gems/ruby-3.3.4/bin/ruby_executable_hooks:22:in `eval'
/usr/share/rvm/gems/ruby-3.3.4/bin/ruby_executable_hooks:22:in `<main>'

It happens due to class method name definition in Faker::Travel::Airport

module Faker
  class Travel
    class Airport < Base
      class << self
        def name(size:, region:)
          fetch("airport.#{region}.#{size}")
        end
      end
    end
  end
end

In this part of code it is safe to check class in related to Mongoid and then check name

@dem
Copy link
Author

dem commented Sep 4, 2024

@mathieujobin Any chances for this PR to be looked into and new gem version issued?

We are currently struggling with gems updates, like faker, because of one failing line in pickle.

Thanks

@mathieujobin
Copy link
Collaborator

Sure thing, I had not noticed this until now. thanks for the ping an the fix

much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants