howdy all, i'm new to ruby and ironruby, and trying to get a simple mspec sample working on my machine. i'm using the 0.3 drop of IR. When i'm running IronRuby for anything OTHER than mspec, it works perfectly fine. The WPF samples, the message box sample - they all work great. In order to play with mspec, i've written a c# dll which returns a string (HelloWorld::HelloClass.SayHello()) and two ruby files to test it out. 1) The first file is a ruby script which requires the DLL and does a puts on the say_hello method. This works, no problem. (eg: ir sayhello.rb) 2) The second file is an mspec script which requires the DLL, requires mspec and has once specification which calls the say_hello method. To run the spec, i've created a batch file which calls ir.exe with the path to c:\ruby\bin\mspec (like the icucumber example). when i run this however, it fails miserably: ---------------- c:\source\ruby\hellodotnet>imspec sayhello_spec.rb ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] 1) An exception occurred during: loading c:/source/ruby/hellodotnet/sayhello_spec.rb ERROR LoadError: 127: The specified procedure could not be found. - Init_HelloWorld ./HelloWorld.dll ./HelloWorld.dll c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' c:/source/ruby/hellodotnet/sayhello_spec.rb:2 Finished in 0.111000 seconds 1 file, 0 examples, 0 expectations, 0 failures, 1 error ----- Not certain, but i suspect that this might have something to do with the fact that it's executing the custom_require.rb file from c:\ruby and not c:\ironruby. The first line from the execution shows it's using ruby 1.8.6. If this indeed the case, what should I do to fix it? i've tried setting the GEM_PATH to various paths with no success. Happy to provide more info if rqd. thanks, Xerx.
on 2009-04-06 10:57
on 2009-04-06 18:39
MSpec is a special runner geared towards running implementation tests. It's kind of nice right now because it's more light weight than RSpec, so IronRuby can run it reasonably. One of the things this runner has is the ability to start up the runner with one implementation, then have that implementation call a second implementation to run the actual specs. So you can run mspec with MRI, and pass it an option which will tell it to run the specs with IronRuby. This feature appears to be biting you here. You are running with IronRuby, but because you aren't passing that option, it is running your specs with MRI. One option is to pass "-t c:\path\to\ir.exe", the other is to have your wrapper run mspec-run or mspec-ci directly (as opposed to the mspec script). Give that a try and let me know if you have any more questions. JD