Showing posts with label cygwin. Show all posts
Showing posts with label cygwin. Show all posts

Tuesday, December 7, 2010

Ruby, rspec 1.x and cygwin

One thing that has irritated me for a long time is the inability to run rspec tests in Cygwin without having to maintain dual environments. Keeping 2 parallel environments one for Windows and one for "Cygwin on Windows" is an exercise in futility. But finally I decided to "hack" it, not that i's really an hack.

Use => ruby "c:\Ruby191\bin\spec" item_spec.rb

Replace C:\Ruby191 with your ruby installation directory and ofc item_spec.rb with your spec file of choice.

For an even more easy way, put it as an alias in your .bash_profile, e.g.
alias rsp="ruby 'c:\Ruby191\bin\spec'"

Then you can use => rsp item_spec.rb

More detailed explanation:
in the bin directory there is an spec.bat, the mixture of Ruby for Windows and Cygwin has a problem with paths. So by running the command in the spec.bat file we circumvent that problem and voila everything works.

Addition: Regarding my environment. Due to restrictions with selenium grid and local factors I am using ruby 1.87 and 1.9.1, with rspec 1.2.8 and latest selenium-client (as of 2010-11).