Hello, Today I ran into some frustration with spec and windows. We have a series of plugins that have either test suites and/or spec suites. To avoid environment collisions, we have a "master" test suite that spawns new process for all of the test suites and spec suites. Every works great on posix. Unfortunately on windows, spec was not found. The only way I figured to ensure we get to spec in a platform independent way is to call: success = true dir = File.dirname(__FILE__) spec_cmd = (RUBY_PLATFORM =~ /[^r]win/) ? ''C:\\ruby\\bin\\spec.cmd'' : ''spec'' success &&= system("#{spec_cmd} --format specdoc --diff unified #{dir}/project_dir/spec_suite.rb") # ... exit success Lame! Does somebody out there have a better solution? Could rspec be run from ruby instead? Thank you, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070105/6f6a5e28/attachment.html
Hi Brian, It looks like c:\ruby\bin isn''t in your PATH environment variable on Windows. (I''ve had problems with the OneClickInstaller not adding this directory to the PATH). If this is true, adding it to PATH should solve your problem.> Could rspec be run from ruby instead?This is similar to a question I was going to ask on this list. I''m trying to figure out how to run a xyz_spec.rb file from within my IDE, rather than having to use spec on the command line. Can anyone tell me how to do this? Thanks, Wayne --- Wayne Vucenic No Bugs Software Ruby, C#, and Erlang Agile Contract Programming in Silicon Valley
On 1/5/07, Wayne Vucenic <waynev at gmail.com> wrote:> Hi Brian, > > It looks like c:\ruby\bin isn''t in your PATH environment variable on > Windows. (I''ve had problems with the OneClickInstaller not adding > this directory to the PATH). If this is true, adding it to PATH > should solve your problem. > > > Could rspec be run from ruby instead? > > This is similar to a question I was going to ask on this list. I''m > trying to figure out how to run a xyz_spec.rb file from within my IDE, > rather than having to use spec on the command line. Can anyone tell > me how to do this?Just require ''spec'' in the file or a file it includes and go: ruby path/to/the/file.rb OR (if you MUST) ruby path\to\the\file.rb Cheers, David> > Thanks, > > Wayne > > --- > > Wayne Vucenic > No Bugs Software > Ruby, C#, and Erlang Agile Contract Programming in Silicon Valley > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Hi David, Thanks for your amazingly prompt reply! On 1/5/07, David Chelimsky <dchelimsky at gmail.com> wrote:> Just require ''spec'' in the file or a file it includes and go: > > ruby path/to/the/file.rb > > OR (if you MUST) > > ruby path\to\the\file.rbWorks like a charm! Now is there any way to get the same output as with "-f s" ? And I completely agree with you on / rather than \ in file paths. The use of \ was one of the most annoying things MS-DOS and then Windows ever did. When I switched from programming on the Mac to Windows NT 3.51 I was glad that all the Win32 APIs accepted either \ or / in paths, so I always preferred /. Thanks, Wayne
> Now is there any way to get the same output as with "-f s" ?I took a look at the source, and answered my own question: require ''spec'' ARGV.unshift("-f", "s") Not the most elegant approach, but it seems to work so far. Wayne