Cucunber - does not honour here-document syntax?


#1

something_steps.rb

TEST = ‘A constant’

puts TEST

SCRIPT <<-‘END_SCRIPT’

END_SCRIPT

Then /…/ do

$ cucumber -r features features/lib/something.feature
A constant
./features/lib/step_definitions/something__steps.rb:9: undefined method
SCRIPT' for #<Object:0x2ba6d15d23e0> (NoMethodError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require’
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
polyglot_original_require' from /usr/lib64/ruby/gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:inrequire’
from
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in
require' from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/cli/main.rb:79:inrequire_files’
from
/usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/…/lib/cucumber/cli/main.rb:77:in
each' from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/cli/main.rb:77:inrequire_files’
from
/usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/…/lib/cucumber/cli/main.rb:34:in
execute!' from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/cli/main.rb:20:inexecute’
from /usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.2/bin/cucumber:6
from /usr/bin/cucumber:19:in `load’
from /usr/bin/cucumber:19
$

Is this a deliberate limitation in Cucumber or a bug?


#2

It’s Ruby, not Cucumber that parses .rb files. (Even if you have ruby
code
that uses the Cucumber API in them).

You have a Ruby syntax error. You missed the = sign after SCRIPT :wink:

Aslak

something_steps.rb


#3

Aslak Hellesøy wrote:

It’s Ruby, not Cucumber that parses .rb files. (Even if you have ruby
code
that uses the Cucumber API in them).

You have a Ruby syntax error. You missed the = sign after SCRIPT :wink:

Aslak

something_steps.rb

Sigh…