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:in `load_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:in `step_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:in `load_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:in `load_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:in `execute'
:0:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.3.101/bin/cucumber:9
c:/ruby/bin/cucumber:19
:0:in `load'
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
on 2010-03-01 16:08
on 2010-03-01 16:25
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.
on 2010-03-01 16:27
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 Deville 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.
on 2010-03-01 16:27
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 Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero)
on 2010-03-01 16:47
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 Carrero 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 Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero)
on 2010-03-01 16:56
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:in `load_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:in `load_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:in `load_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: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:in `execute'
:0:in `each'
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>
on 2010-03-01 17:11
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.
on 2010-03-01 17:28
Try to run icucumber with the --no-color switch. -------------------------------------------------------- Shay Friedman | .NET Technologies Expert | Author of IronRuby Unleashed | Sela Technology Center Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay
on 2010-03-01 17:35
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 <number>
When I pass the number to a IsPrime method
Then I should get <result> 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:in `load_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:in `load_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:in `load_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: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:in `execute'
:0:in `each'
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>
on 2010-03-01 18:11
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
on 2010-03-01 18:15
Can you modify icucumber to run ir -d to turn on debug mode? That should give some logs that will help. JD
on 2010-03-01 18:17
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 Deville 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
on 2010-03-01 18:19
When I type ir -d on the command prompt it takes me to the ironruby interactive console?
on 2010-03-01 18:30
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
on 2010-03-01 18:36
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 Deville 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
on 2010-03-01 18:53
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
on 2010-03-01 18:56
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 Deville 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
on 2010-03-01 19:04
Ok. We're missing something here. Let's take this offline. Email me personally, with a copy of your project if you can. JD
on 2010-03-01 19:11
to get a backtrace of what's happening you can run icucumber -b features/prime.feature --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero 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
on 2010-03-01 19:28
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:in `require'
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: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: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:in `load_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: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: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:in `execute'
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 Carrero 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 Carrero
> 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
on 2010-03-01 19:36
Seems like the forums file attach limit is less then 1.5 MB (Are we living in the 80's? :) Anyway, here is the url: http://www.highoncoding.com/articledownloads/IronRubyConsoleApp.zip Jim Deville wrote: > Ok. We're missing something here. Let's take this offline. Email me > personally, with a copy of your project if you can. > > JD
on 2010-03-01 20:06
Heh, that's why I said send it to me offline. Anyways, addition.rb is pure ruby, you can't have the last three lines of the file as is. JD
on 2010-03-01 20:09
But I am trying to execute prime_steps.rb. Does it execute all of them by default or something?? Jim Deville wrote: > Heh, that's why I said send it to me offline. Anyways, addition.rb is > pure ruby, you can't have the last three lines of the file as is. > > JD
on 2010-03-01 20:11
I cannot believe it that was the problem. I deleted the addition.rb file and it started working. Lesson learned!! Cucumber will execute everything inside the step_definations. Jim Deville wrote: > Heh, that's why I said send it to me offline. Anyways, addition.rb is > pure ruby, you can't have the last three lines of the file as is. > > JD
on 2010-03-01 20:19
The thing is, you might have a login.rb file that has login steps, that is then used in all of your features that require logging in. It appears you can override automatic loading via -r, but otherwise, it has to load everything to be safe. JD
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.