# Spec Error with IronRuby for Loading .NET DLL

**URL:** <https://www.ruby-forum.com/t/spec-error-with-ironruby-for-loading-net-dll/175935>\
**Category:** IronRuby\
**Created:** [September 23, 2009, 12:49am UTC](https://www.ruby-forum.com/t/spec-error-with-ironruby-for-loading-net-dll/175935 "2009-09-23T00:49:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 23, 2009, 12:49am UTC](https://www.ruby-forum.com/t/spec-error-with-ironruby-for-loading-net-dll/175935/1 "2009-09-23T00:49:11Z")

</div>

I have done this before but for some reason this is failing:

require ‘rubygems’  
require ‘spec’  
require File.dirname( **FILE** ) + ‘/bin/Debug/BusinessObjects.dll’

include BusinessObjects

describe PrimeService do

it “should return false when 1 is passed” do

@primeService = PrimeService.new  
@primeService.IsPrime(1).should == false

end

end

And here is error:

C:\Projects\ILoveIronRuby\ILoveIronRuby\ILoveIronRubyConsole\>spec  
test\_prime\_no\_  
spec.rb  
./bin/Debug/BusinessObjects.dll: 127: The specified procedure could not  
be  
found  
. - Init\_BusinessObjects (LoadError)  
./bin/Debug/BusinessObjects.dll from  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/cus  
tom\_require.rb:31:in `require' from ./test_prime_no_spec.rb:4 from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_ group_runner.rb:15:in`load’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example\_  
group\_runner.rb:15:in `load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_ group_runner.rb:14:in`each’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example\_  
group\_runner.rb:14:in `load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options. rb:107:in`run\_examples’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command\_  
line.rb:9:in `run' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/bin/spec:4 from c:/ruby/bin/spec:19:in`load’  
from c:/ruby/bin/spec:19

When I use simple Test::Unit::TestCase then it works fine and loads the  
BusinessObjects.dll!

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 23, 2009, 6:09am UTC](https://www.ruby-forum.com/t/spec-error-with-ironruby-for-loading-net-dll/175935/2 "2009-09-23T06:09:02Z")

</div>

I used the BusinessObjects.dll that you sent me, and everything worked  
fine:

> > > require ‘BusinessObjects’  
> > > =\> true  
> > > include BusinessObjects  
> > > =\> Object  
> > > p = PrimeService.new  
> > > =\> BusinessObjects.PrimeService  
> > > p.is\_prime(1)  
> > > =\> false

* * *

From: removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid] on behalf of Mohammad A.  
[removed\_email\_address@domain.invalid]  
Sent: Tuesday, September 22, 2009 2:31 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Spec Error with IronRuby for Loading .NET DLL

I have done this before but for some reason this is failing:

require ‘rubygems’  
require ‘spec’  
require File.dirname( **FILE** ) + ‘/bin/Debug/BusinessObjects.dll’

include BusinessObjects

describe PrimeService do

it “should return false when 1 is passed” do

@primeService = PrimeService.new  
@primeService.IsPrime(1).should == false

end

end

And here is error:

C:\Projects\ILoveIronRuby\ILoveIronRuby\ILoveIronRubyConsole\>spec  
test\_prime\_no\_  
spec.rb  
./bin/Debug/BusinessObjects.dll: 127: The specified procedure could not  
be found  
. - Init\_BusinessObjects (LoadError)  
./bin/Debug/BusinessObjects.dll from  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/cus  
tom\_require.rb:31:in `require' from ./test_prime_no_spec.rb:4 from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_ group_runner.rb:15:in `load’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example\_  
group\_runner.rb:15:in `load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_ group_runner.rb:14:in `each’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example\_  
group\_runner.rb:14:in `load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options. rb:107:in `run\_examples’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command\_  
line.rb:9:in `run' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/bin/spec:4 from c:/ruby/bin/spec:19:in `load’  
from c:/ruby/bin/spec:19

When I use simple Test::Unit::TestCase then it works fine and loads the  
BusinessObjects.dll!

–  
Mohammad A.  
MVP (Microsoft Valuable Professional)  
[www.highoncoding.com](http://www.highoncoding.com)[http://www.highoncoding.com](http://www.highoncoding.com)  
[www.azamsharp.com](http://www.azamsharp.com)[http://www.azamsharp.com](http://www.azamsharp.com)

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 23, 2009, 6:10am UTC](https://www.ruby-forum.com/t/spec-error-with-ironruby-for-loading-net-dll/175935/3 "2009-09-23T06:10:13Z")

</div>

I solved the problem by uninstalling the spec gem from the Ruby MRI.  
This  
way IronRuby only find one implementation of Spec gem which was  
contained in  
the gems folder of the IronRuby.

On Tue, Sep 22, 2009 at 9:07 PM, Jimmy S. \<
