jayzes / cucumber-api-steps

Cucumber steps to easily test REST-based XML and JSON APIs
MIT License
251 stars 82 forks source link

undefined method `symbol' for nil:NilClass #42

Open aaronshim opened 8 years ago

aaronshim commented 8 years ago

Line 54 of api_steps.rb (request path, request_opts) throws the undefined methodsymbol' for nil:NilClass` in Rails 5 on API mode.

I'm currently using an emergency patch of api_steps.rb

What could be causing the error? I would like to eventually move the call back to request.

kalys commented 8 years ago

Hello Aaron. Could you provide stack trace of error?

aaronshim commented 8 years ago

@kalys How would I get the stack trace? I only found the line undefined method``symbol' for nil:NilClass when I ran cucumber , and by modifying the code in the step definitions, I found that the line at fault was the request call.

Is there a way to get the system to display a stack trace?

kalys commented 8 years ago

Could you try to run cucumber with -b option?

aaronshim commented 8 years ago

@kalys the stack trace, obtained from running it with the -b option, is as follows

undefined method `symbol' for nil:NilClass (NoMethodError)
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/http/parameters.rb:63:in `parse_formatted_parameters'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/http/request.rb:366:in `block in POST'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/request.rb:57:in `fetch'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/request.rb:57:in `fetch_header'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/http/request.rb:365:in `POST'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/http/parameters.rb:35:in `parameters'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/http/filter_parameters.rb:41:in `filtered_parameters'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:21:in `process_action'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activerecord-5.0.0.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:126:in `process'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionview-5.0.0.1/lib/action_view/rendering.rb:30:in `process'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:190:in `dispatch'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:262:in `dispatch'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `serve'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:39:in `block in serve'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `each'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `serve'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:725:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/conditional_get.rb:38:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-rails-1.4.4/lib/cucumber/rails/action_controller.rb:10:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bundler/gems/rack-cors-7411d0c709af/lib/rack/cors.rb:80:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/rack-test-0.6.3/lib/rack/test.rb:124:in `request'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bundler/gems/cucumber-api-steps-190d0930c0d7/lib/cucumber/api_steps.rb:54:in `block in <top (required)>'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/core_ext/instance_exec.rb:25:in `instance_exec'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/core_ext/instance_exec.rb:25:in `block in cucumber_instance_exec'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/core_ext/instance_exec.rb:42:in `cucumber_run_with_backtrace_filtering'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/core_ext/instance_exec.rb:13:in `cucumber_instance_exec'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_step_definition.rb:102:in `invoke'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/step_match.rb:27:in `invoke'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/step_match.rb:20:in `block in activate'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/action.rb:23:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/step.rb:31:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:104:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:51:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:26:in `test_step'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/step.rb:16:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:26:in `block (3 levels) in describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:25:in `each'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:25:in `block (2 levels) in describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/prepare_world.rb:22:in `block in test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/around_hook.rb:16:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:104:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:51:in `execute'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:33:in `around_hook'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/around_hook.rb:11:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:106:in `block (2 levels) in compose_around_hooks'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:107:in `compose_around_hooks'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:24:in `block in describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:18:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/prepare_world.rb:11:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/apply_around_hooks.rb:8:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/apply_after_hooks.rb:5:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/apply_before_hooks.rb:5:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/apply_after_step_hooks.rb:8:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/activate_steps.rb:11:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/filters/quit.rb:11:in `test_case'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:17:in `block in done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `each'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/filter.rb:61:in `done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/compiler.rb:23:in `done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/parser.rb:35:in `done'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:29:in `parse'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:18:in `compile'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:67:in `run!'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bin/cucumber:23:in `load'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bin/cucumber:23:in `<main>'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bin/ruby_executable_hooks:15:in `eval'
      /home/aaron/.rvm/gems/ruby-2.3.1@rails5/bin/ruby_executable_hooks:15:in `<main>'
      features/sign_up.feature:6:in `When I send a POST request to "/auth/" with the following:'