IronRuby, Cucumber, & win32console: Picking up the Gauntlet
Shortly after I published my previous post on getting IronRuby working with Cucumber, I did a git pull and recompile from the IronRuby repo. Well, something changed which broke command line option parsing for igem. I’m happy to report that this commit appears to have fixed the issue. Yay!
Also, I’ve forked IronRuby on GitHub and have made the changes I documented on the previous post to Dev.bat. I plan to track IronRuby closely, so if you don’t want to follow all the directions (I still recommend setting up the shortcut to dev.bat), you can simply clone my repo.
Finally, Shri Borde put out a call on the IronRuby mailing list asking if anyone was interested in porting win32console to IronRuby. As Shri pointed out, this is important because Cucumber makes use of win32console on windows platforms to colorize the output of cucumber runs. This makes it much easier to visualize what works, what’s broken, and what steps you need to write. Since I have more than a passing interest in getting Cucumber working for .Net apps, I am going to pick up the gauntlet and attempt to port it myself. Behold ironruby-win32console. Now, to figure out how to do it…

Hi,
This sounds good, I may also be interested in contributing (if so, I’ll probably just fork your code from GitHub
As an aside, I’m getting a lot of strange characters on the console when I try to run the features from the cucumber gem:
Scenario Outline: Add two numbers←[90m # features/addition.feature:6←[0m
unknown:0: warning: multiple values for a block parameter (2 for 1)
←[36mGiven I have entered into the calculator←[90m # UNKNOWN:-1←[0m←[0m
unknown:0: warning: multiple values for a block parameter (2 for 1)
←[36mAnd I have entered into the calculator←[90m # UNKNOWN:-1←[0m←[0m
unknown:0: warning: multiple values for a block parameter (2 for 1)
←[36mWhen I press add←[90m # UNKNOWN:-1←[0m←[0m
unknown:0: warning: multiple values for a block parameter (2 for 1)
←[36mThen the result should be on the screen←[90m # UNKNOWN:-1←[0m←[0m
Have you seen this before? I was wondering whether it had anything to do with the colouring output not rendering properly (hence my interest in the port
I’m using IronRuby 0.5.0
thanks,
Nick
Those “strange characters” are ANSI control codes, which non-Windows terminals interpret to set the color for the characters that are output. This is why we need to port Win32Console, or use some other API for setting the colors. I’ve decided to start working on the latter, and am working on iron-term-ansicolor. Since I can access the .Net BCL directly in IronRuby, I’m simply going to alias and override Kernel#puts and Kernel#print to call the appropriate System.Console API’s before sending the string, scrubbed of ANSI control codes, to standard out.
@Will
What’s the status of the project? Is it usable?
@Nick C
If you run cucumber with the switch –no-colors you won’t get the color codes to the terminal. I got the same problem when doing a write-up on cucumber + ironruby here: http://blog.thomaslundstrom.com/2009/08/on-running-cucumber-under-ironruby-09.html
We now have a .net MVC project, my boss want me to use Cucumber and IronRuby to do the acceptance test, here comes the question, is that possible to use webrat with IronRuby, Or there is another browser simulator that can be used in this scenario.
I don’t know. If it didn’t, I’m certain you could swap it out for something like WatiR/WatiN or Selenium.