cucumber/cucumber — Issue #188: Error in step_match.rb file. Method replace_arguments
Author: korsakovs
Created: 2011-11-29 13:52:44+00:00
State: open

I've checked is cucumber v.1.1.3 and it raises an exception for the following step:

```ruby
When /^I do something( with note "[^"]+")?$/ do | note |
# Some code here
end
```

Exception:
(Yes, I am using jruby)

```
undefined method `length' for nil:NilClass (NoMethodError)
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/step_match.rb:73:in `replace_arguments'
org/jruby/RubyArray.java:1602:in `each'

/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/step_match.rb:62:in `replace_arguments'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/step_match.rb:44:in `format_args'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/formatter/console.rb:25:in `format_step'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/formatter/pretty.rb:151:in `step_name'
org/jruby/RubyKernel.java:2071:in `send'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:173:in `send_to_all'
org/jruby/RubyArray.java:1602:in `each'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:171:in `send_to_all'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:166:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:112:in `visit_step_name'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:105:in `visit_step_result'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:104:in `visit_step_result'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/step_invocation.rb:46:in `visit_step_result'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/step_invocation.rb:39:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:99:in `visit_step'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/step_collection.rb:15:in `accept'
org/jruby/RubyArray.java:1602:in `each'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/step_collection.rb:14:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:93:in `visit_steps'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/scenario.rb:55:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:80:in `with_hooks'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:96:in `before_and_after'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:79:in `with_hooks'
org/jruby/RubyProc.java:268:in `call'
org/jruby/RubyProc.java:228:in `call'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime/support_code.rb:120:in `around'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/language_support/language_methods.rb:9:in `around'
org/jruby/RubyProc.java:268:in `call'
org/jruby/RubyProc.java:228:in `call'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/language_support/language_methods.rb:91:in `execute_around'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/language_support/language_methods.rb:8:in `around'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime/support_code.rb:119:in `around'
org/jruby/RubyProc.java:268:in `call'
org/jruby/RubyProc.java:228:in `call'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime/support_code.rb:117:in `around'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:91:in `around'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:78:in `with_hooks'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/scenario.rb:53:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/scenario.rb:108:in `with_visitor'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/scenario.rb:47:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/feature.rb:43:in `accept'
org/jruby/RubyArray.java:1602:in `each'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/feature.rb:42:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:20:in `visit_feature'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/features.rb:29:in `accept'
org/jruby/RubyArray.java:1602:in `each'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/features.rb:17:in `each'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/features.rb:28:in `accept'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:14:in `visit_features'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/runtime.rb:46:in `run!'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/cli/main.rb:43:in `execute!'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/../lib/cucumber/cli/main.rb:20:in `execute'
/opt/jruby-1.6.2/lib/ruby/gems/1.8/gems/cucumber-1.1.3/bin/cucumber:14:in `(root)'
org/jruby/RubyKernel.java:1063:in `load'
/opt/jruby/bin/cucumber:19:in `(root)'
```

Everything ok when I'm using cucumber v.1.1.1.

Thanks