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

rspec issue (Wrong number of arguments. Expected 1 or more, got 0.) #1921

Closed
petenorth opened this issue Feb 23, 2020 · 4 comments
Closed

rspec issue (Wrong number of arguments. Expected 1 or more, got 0.) #1921

petenorth opened this issue Feb 23, 2020 · 4 comments
Assignees
Milestone

Comments

@petenorth
Copy link

petenorth commented Feb 23, 2020

I am trying to get some rspec test working for an existing project.

https://github.com/petenorth/schools-experience

There is a failure that appears for a number of tests and so I was hoping for some guidance (it works in MRI)

VERSION: truffleruby 20.1.0-dev-08311e22, like ruby 2.6.5, GraalVM CE Native [x86_64-linux]

2020-02-23T14:09:06.7721623Z      Failure/Error: Rails.configuration.x.dfe_sign_in_api_enabled,
2020-02-23T14:09:06.7721723Z 
2020-02-23T14:09:06.7722045Z      ArgumentError:
2020-02-23T14:09:06.7724459Z        Wrong number of arguments. Expected 1 or more, got 0.
2020-02-23T14:09:06.7793347Z      # ./app/forms/schools/change_school.rb:11:in `allow_school_change_in_app?'
2020-02-23T14:09:06.7793803Z      # ./app/controllers/schools/change_schools_controller.rb:28:in `ensure_in_app_school_changing_enabled?'
2020-02-23T14:09:06.7794338Z      # /truffleruby-head/lib/gems/gems/sentry-raven-2.13.0/lib/raven/integrations/rails/controller_transaction.rb:7:in `call'
2020-02-23T14:09:06.7794830Z      # /truffleruby-head/lib/gems/gems/sentry-raven-2.13.0/lib/raven/integrations/rails/controller_transaction.rb:7:in `block in included'
2020-02-23T14:09:06.7799089Z      # /truffleruby-head/lib/gems/gems/bullet-6.1.0/lib/bullet/rack.rb:15:in `call'
2020-02-23T14:09:06.7799515Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/tempfile_reaper.rb:17:in `call'
2020-02-23T14:09:06.7799917Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/etag.rb:27:in `call'
2020-02-23T14:09:06.7800325Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/conditional_get.rb:40:in `call'
2020-02-23T14:09:06.7800716Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/head.rb:14:in `call'
2020-02-23T14:09:06.7807066Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/session/abstract/id.rb:269:in `context'
2020-02-23T14:09:06.7807761Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/session/abstract/id.rb:263:in `call'
2020-02-23T14:09:06.7808215Z      # /truffleruby-head/lib/gems/gems/railties-5.2.4.1/lib/rails/rack/logger.rb:38:in `call_app'
2020-02-23T14:09:06.7813279Z      # /truffleruby-head/lib/gems/gems/railties-5.2.4.1/lib/rails/rack/logger.rb:26:in `block in call'
2020-02-23T14:09:06.7813702Z      # /truffleruby-head/lib/gems/gems/railties-5.2.4.1/lib/rails/rack/logger.rb:26:in `call'
2020-02-23T14:09:06.7814059Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/method_override.rb:24:in `call'
2020-02-23T14:09:06.7817486Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/runtime.rb:24:in `call'
2020-02-23T14:09:06.7817904Z      # /truffleruby-head/lib/gems/gems/rack-2.1.2/lib/rack/sendfile.rb:113:in `call'
2020-02-23T14:09:06.7818332Z      # /truffleruby-head/lib/gems/gems/sentry-raven-2.13.0/lib/raven/integrations/rack.rb:51:in `call'
2020-02-23T14:09:06.7818742Z      # /truffleruby-head/lib/gems/gems/rack-rewrite-1.5.1/lib/rack/rewrite.rb:24:in `call'
2020-02-23T14:09:06.7819359Z      # /truffleruby-head/lib/gems/gems/railties-5.2.4.1/lib/rails/engine.rb:524:in `call'
2020-02-23T14:09:06.7827717Z      # /truffleruby-head/lib/gems/gems/rack-test-1.1.0/lib/rack/mock_session.rb:29:in `request'
2020-02-23T14:09:06.7828151Z      # /truffleruby-head/lib/gems/gems/rack-test-1.1.0/lib/rack/test.rb:266:in `process_request'
2020-02-23T14:09:06.7828557Z      # /truffleruby-head/lib/gems/gems/rack-test-1.1.0/lib/rack/test.rb:119:in `request'
2020-02-23T14:09:06.7829012Z      # /truffleruby-head/lib/gems/gems/rails-controller-testing-1.0.4/lib/rails/controller/testing/integration.rb:13:in `post'
2020-02-23T14:09:06.7829472Z      # ./spec/controllers/schools/change_schools_controller_spec.rb:92:in `subject'
2020-02-23T14:09:07.5693773Z      # ./spec/controllers/schools/change_schools_controller_spec.rb:95:in `block (4 levels) in <top (required)>'
2020-02-23T14:09:07.5777952Z      # /truffleruby-head/lib/mri/bundler/cli/exec.rb:74:in `load'
2020-02-23T14:09:07.5778716Z      # /truffleruby-head/lib/mri/bundler/cli/exec.rb:74:in `load'
2020-02-23T14:09:07.5783664Z      # /truffleruby-head/lib/mri/bundler/cli/exec.rb:74:in `kernel_load'
2020-02-23T14:09:07.5784321Z      # /truffleruby-head/lib/mri/bundler/cli/exec.rb:28:in `run'
2020-02-23T14:09:07.5787319Z      # /truffleruby-head/lib/mri/bundler/cli.rb:463:in `exec'
2020-02-23T14:09:07.5787918Z      # /truffleruby-head/lib/mri/bundler/cli.rb:27:in `dispatch'
2020-02-23T14:09:07.5788542Z      # /truffleruby-head/lib/mri/bundler/cli.rb:18:in `start'
2020-02-23T14:09:07.5792368Z      # /truffleruby-head/lib/mri/bundler/friendly_errors.rb:124:in `with_friendly_errors'```
@petenorth
Copy link
Author

petenorth commented Feb 24, 2020

Unfortunately to reproduce requires a Postgres instance but (from the root directory)

docker build -f Dockerfile-truffleruby-head -t school-experience:latest .
docker-compose up -d
WAIT_COUNT=0
until docker-compose ps | grep -m 1 "db-tasks" | grep -m 1 "Exit 0" || [ $WAIT_COUNT -eq 48 ]; do echo "WAIT COUNT $(( WAIT_COUNT++ ))" && sleep 5 ; done
docker-compose run --no-deps --rm db-tasks rspec ./spec/controllers/schools/change_schools_controller_spec.rb

@aardvark179 aardvark179 self-assigned this Feb 27, 2020
@aardvark179
Copy link
Contributor

This appears to be a problem inside rspec-mocks where it's miss validating the actual arguments against the signature. I'm kind of glad they don't have quite the same wording as the core argument error message, otherwise this would have been really hard to track down. :-)

I'll investigate a little more and see if I can find the root cause of this issue.

@aardvark179
Copy link
Contributor

@petenorth, I've found the root cause of this. If you look up a method on an object that implements method_missing for that method then we return a method object which returns the wrong arity and parameters. I've got a fix for this which I'll create an internal PR for, and it appears to fix almost all the other spec failures in your app.

@petenorth
Copy link
Author

@aardvark179 Fantastic - have just run the specs against the nightly build that includes your fix and the issue has been resolved.

The situation with the specs is now

3560 examples, 5 failures, 2 pending

And three of the failures I think are covered by the fix by @eregon for the sha2 issue which just missed the nightly build.

@eregon eregon added this to the 20.1.0 milestone Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants