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:inload’
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:ineach’
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:inrun_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:inload’
from c:/ruby/bin/spec:19

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

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: [email protected]
[[email protected]] on behalf of Mohammad A.
[[email protected]]
Sent: Tuesday, September 22, 2009 2:31 PM
To: [email protected]
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:inload’
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:ineach’
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:inrun_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:inload’
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.comhttp://www.highoncoding.com
www.azamsharp.comhttp://www.azamsharp.com

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. <

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs