# [Ironruby-core] MSpec fails to load dll

Jim Deville jdeville at microsoft.com
Mon Apr 6 12:14:18 EDT 2009

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

> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Xerxes Battiwalla
> Sent: Monday, April 06, 2009 1:39 AM
> To: ironruby-core at rubyforge.org
> Subject: [Ironruby-core] MSpec fails to load dll
>
> 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]
>
> 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.
>
`