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

undefined method `exclude?' for [JSON, [JSON]]:Array #2364

Closed
ericproulx opened this issue Oct 29, 2023 · 3 comments · Fixed by #2365
Closed

undefined method `exclude?' for [JSON, [JSON]]:Array #2364

ericproulx opened this issue Oct 29, 2023 · 3 comments · Fixed by #2365

Comments

@ericproulx
Copy link
Contributor

While running benchmark/large_model locally, I stumbled upon this following error

 undefined method `exclude?' for [JSON, [JSON]]:Array

I ran the entire spec suite locally and I never faced the issue. After some investigation, I've figured that grape-entity is automatically loaded while running RSpec and it's requiring require 'active_support/core_ext/enumerable. Therefore, exclude? works on any enum. I'll create a PR to require it on our own.

@ericproulx
Copy link
Contributor Author

Step to reproduce

  1. add require: false to grape-entity in the Gemfile
  2. run spec/grape/validations/validators/coerce_spec.rb:650 ( docker-compose run --rm --build grape rspec spec/grape/validations/validators/coerce_spec.rb:650)

@ericproulx
Copy link
Contributor Author

It requires core_ext

@ericproulx
Copy link
Contributor Author

By excluding grape-entity, some tests are failing. We're missing the following

require 'active_support/core_ext/object/deep_dup'
require 'active_support/core_ext/string/exclude'

A test is using second but I'll change it to [1] since its not use in the gem just in spec

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 a pull request may close this issue.

1 participant