Cucumber with IronRuby

I don’t know why I keep getting the following exception when I try to
run cucumber with Ironruby.

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>icucumber
features/pr
ime.feature --no-color
syntax error, unexpected IDENTIFIER, expecting ‘{’, or DO, or ‘(’
(SyntaxError)
:0:in require' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/../lib/cucumber/rb_support/r b_language.rb:101:inload_code_file’
custom_require.rb:30:in require' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/../lib/cucumber/rb_support/r b_language.rb:46:instep_definitions_for’
polyglot.rb:69:in require' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/../lib/cucumber/step_mother. rb:118:inload_code_file’
c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/…/lib/cucumber/step_mother.
rb:110:in load_code_files' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/../lib/cucumber/step_mother. rb:109:inload_code_files’
c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/…/lib/cucumber/cli/main.rb:
48:in execute!' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/../lib/cucumber/cli/main.rb: 23:inexecute’
:0:in each' c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/cucumber:9 c:/ruby/bin/cucumber:19 :0:inload’

I have even updated the path in my icucumber.bat file as follows:

@ECHO OFF
REM This is to tell IronRuby where to find gems.
SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8
@“C:\DevTools\ironruby-1.0-rc1\bin\ir.exe” “c:\ruby\bin\cucumber”

%*

Thanks,
Azam

Looks like a syntax error where you have a identifier (method name or
variable name) where a block is expected. Can you figure out where the
error is being raised? The fact that it is in a method called
“load_code_file” leads me to suspect it is one of the test files as
opposed to the cucumber files.

Thanks for the reply! My test file called “primeservice.rb” is placed
inside the step_definations folder which is inside the feature folder.
Like this:

features/step_definations/primeservice.rb

The primeservice.rb looks something like this:

require ‘rubygems’
require ‘spec/expectations’

require File.expand_path(“bin/Debug/BusinessObjects.dll”)

include BusinessObjects

Thanks,
Azam

Jim D. wrote:

Looks like a syntax error where you have a identifier (method name or
variable name) where a block is expected. Can you figure out where the
error is being raised? The fact that it is in a method called
“load_code_file” leads me to suspect it is one of the test files as
opposed to the cucumber files.

First of all upgrade to ironruby rc2.
Also I thought we had a very long discussion on mixing gems installed in
a
different ruby. Let’s not repeat that one and keep it at don’t mix gem
installs.

then try this:

ir -S gem install cucumber ironterm-ansicolor
ir -S cucumber features/prime.feature

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

The ir-S gem install cucumber did not work:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>ir -S gem
install cuc
umber ironterm-ansicolor
Option `-S’ not supported

First of all upgrade to ironruby rc2.

Maybe later! I am afraid it will going to mess things up for me.

Ivan Porto C. wrote:

First of all upgrade to ironruby rc2.
Also I thought we had a very long discussion on mixing gems installed in
a
different ruby. Let’s not repeat that one and keep it at don’t mix gem
installs.

then try this:

ir -S gem install cucumber ironterm-ansicolor
ir -S cucumber features/prime.feature

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

My feature file is called prime.feature and now I added a new test
file called “prime_steps” (I thought maybe the name has to be same).
After running the icucumber features/prime.feature I still get the same
error. The strange thing is that I don’nt have any code in the test
file. It is totally blank.

Try to run icucumber with the --no-color switch.


Shay F. | .NET Technologies Expert | Author of IronRuby Unleashed
|
Sela Technology Center
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

What does prime.feature look like then?

I installed the icucumber again using the following command:

igem install cucumber

the install went fine. then i said

icucumber on the command prompt and I got the following:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>icucumber
*** WARNING: You must “igem install iron-term-ansicolor” to get coloured
ouput i
n on IronRuby
syntax error, unexpected IDENTIFIER, expecting ‘{’, or DO, or ‘(’
(SyntaxError)
:0:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/rb_support/rb_language.rb:124:inload_code_file’
custom_require.rb:30:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:84:inload_code_file’
polyglot.rb:64:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:76:inload_code_files’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/step_mother.rb:75:in load_code_files' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/cli/main.rb:51:inexecute!’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/cli/main.rb:20:in execute' :0:ineach’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/cucum
ber:8
c:/ruby/bin/cucumber:19
:0:in `load’

So, I tried installing the iron-term-ansicolor but I got the following:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>igem install
iron-ter
m-ansicolor
ERROR: While executing gem … (IndexError)
Index was outside the bounds of the array.

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>

That’s why rc2 was FIRST. -S is an option added in rc2. If you want to
support our project, we would appreciate it if you worked with the up to
date bits so that we can be certain we aren’t fighting against a
resolved bug.

JD

Here is prime.feature:

Feature: Prime Number Detection

I need to find if a number is prime or not

Scenario Outline: Prime Number Testing
Given I have a
When I pass the number to a IsPrime method
Then I should get indication prime or not

Examples:

| number | result |
| 1 | true |
| 2 | true |
| 4 | false |

I ran without the --no-color and still getting the same issue:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>icucumber
features/pr
ime.feature
*** WARNING: You must “igem install iron-term-ansicolor” to get coloured
ouput i
n on IronRuby
syntax error, unexpected IDENTIFIER, expecting ‘{’, or DO, or ‘(’
(SyntaxError)
:0:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/rb_support/rb_language.rb:124:inload_code_file’
custom_require.rb:30:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:84:inload_code_file’
polyglot.rb:64:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:76:inload_code_files’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/step_mother.rb:75:in load_code_files' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/cli/main.rb:51:inexecute!’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/cli/main.rb:20:in execute' :0:ineach’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/cucum
ber:8
c:/ruby/bin/cucumber:19
:0:in `load’

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>

Can you modify icucumber to run ir -d to turn on debug mode? That should
give some logs that will help.

JD

When I type ir -d on the command prompt it takes me to the ironruby
interactive console?

Can you modify icucumber to run ir -d to turn on debug mode? That should
give some logs that will help. This is not the same as typing ir -d on
the command line. This is modifying the icucumber.bat file you showed
earlier to use the -d option. Then run icucumber feature/whatever like
you were before.

JD

JD

Just modified the icucumber.bat to this:

@ECHO OFF
REM This is to tell IronRuby where to find gems.
SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8
@“C:\DevTools\ironruby-1.0-rc1\bin\ir.exe -d” "c:\ruby\bin

\cucumber" %*

Now ran the icucumber and got the following:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>icucumber
features/pr
ime.feature
‘“C:\DevTools\ironruby-1.0-rc1\bin\ir.exe -d”’ is not recognized as an
internal
or external command,
operable program or batch file.

Thanks,
Azam

Jim D. wrote:

Can you modify icucumber to run ir -d to turn on debug mode? That should
give some logs that will help. This is not the same as typing ir -d on
the command line. This is modifying the icucumber.bat file you showed
earlier to use the -d option. Then run icucumber feature/whatever like
you were before.

JD

JD

Get rid of the quotes. You don’t have spaces in your path, so it
shouldn’t be needed. Can we also get you to join the mailing list so
that the threads are preserved better? The ruby-forum isn’t good for
these long conversations.

JD

Here is the updated:

@ECHO OFF
REM This is to tell IronRuby where to find gems.
SET GEM_PATH=c:\ruby\lib\ruby\gems\1.8
C:\DevTools\ironruby-1.0-rc1\bin\ir.exe -d c:\ruby\bin\cucumber %*

still giving the same error and took 20 seconds to execute icucumber
command.

Jim D. wrote:

Get rid of the quotes. You don’t have spaces in your path, so it
shouldn’t be needed. Can we also get you to join the mailing list so
that the threads are preserved better? The ruby-forum isn’t good for
these long conversations.

JD

I can perform the update but I am afraid that it will break my previous
code and I cannot take that risk right now. Is there anyway to solve the
issue on RC1?

Thanks,
Azam

Jim D. wrote:

That’s why rc2 was FIRST. -S is an option added in rc2. If you want to
support our project, we would appreciate it if you worked with the up to
date bits so that we can be certain we aren’t fighting against a
resolved bug.

JD

to get a backtrace of what’s happening you can run icucumber -b
features/prime.feature

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Microsoft IronRuby/C# MVP

I got the following after running it using the -b option:

C:\Projects\ILoveIronRuby\ILoveIronRuby\IronRubyConsoleApp>icucumber -b
features
/prime.feature
*** WARNING: You must “igem install iron-term-ansicolor” to get coloured
ouput i
n on IronRuby
syntax error, unexpected IDENTIFIER, expecting ‘{’, or DO, or ‘(’
(SyntaxError)
:0:in require' C:/DevTools/ironruby-1.0-rc1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:3 1:inrequire’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/polyglot-0.3.0/lib/polyg
lot.rb:65:in require' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/rb_support/rb_language.rb:124:inload_code_file’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/step_mother.rb:84:in load_code_file' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:76:inload_code_files’
:0:in each' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/step_mother.rb:75:inload_code_files’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/…/li
b/cucumber/cli/main.rb:51:in execute!' C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/../li b/cucumber/cli/main.rb:20:inexecute’
C:/DevTools/ironruby-1.0-rc1/lib/ironruby/gems/1.8/gems/cucumber-0.6.2/bin/cucum
ber:8
:0:in `load’
c:/ruby/bin/cucumber:19

Ivan Porto C. wrote:

to get a backtrace of what’s happening you can run icucumber -b
features/prime.feature

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Web: http://whiterabbitconsulting.eu - http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Microsoft IronRuby/C# MVP

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs