Did Something Changed Again in Spec

I am trying to unit test my .NET CLR assembly using IronRuby spec
framework. First, the following command does not work anymore

igem install spec

Now, I have to type the following:

igem install rspec

Anyway, when I run the following script:

require ‘rubygems’
require ‘spec’

require File.dirname(FILE) + ‘/bin/Debug/EStudy.Domain.Model.dll’

include EStudy.Domain.Model.Model

user = User.new

describe User, “when user is created” do

it “should not be null” do

user.should == null

end

end

I get the following error:

C:\Projects\EStudyVS2008\EStudySoltution\EStudy\ConsoleApplication2>spec
test_us
er.rb --format nested
./bin/Debug/EStudy.Domain.Model.dll: 127: The specified procedure could
not be f
ound. - Init_EStudy (LoadError)
./bin/Debug/EStudy.Domain.Model.dll from
c:/ruby/lib/ruby/site_ruby/1.8/ruby
gems/custom_require.rb:31:in require' from ./test_user.rb:5 from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_ group_runner.rb:15:inload’
from
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_
group_runner.rb:15:in load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_ group_runner.rb:14:ineach’
from
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_
group_runner.rb:14:in load_files' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options. rb:133:inrun_examples’
from
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_
line.rb:9:in run' from c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5 from c:/ruby/bin/spec:19:inload’
from c:/ruby/bin/spec:19

Any ideas! I am using the exactly the same code I used before. Before I
used it on IronRuby 0.9 version and now I am using IronRuby RC.

Igem install spec never worked. It’s always been igem install rspec. And
before you complain about the confusion, that is the RSpec project’s
(rspec.info) choice, not ours.

It also looks like when you run spec, you are running the Ruby version,
not the IronRuby version.

JD

I did ran igem install spec and it worked fine in IR 0.9. Anyway, how
should I make it work with IronRuby and not Ruby. Does this mean I have
to alter the ENV path AGAIN!

the command you want is ispec

or you’re mixing the gems from your MRI install in which case I’d say
don’t
do that nastiness follows.


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

man! changing the PATH variable isn’t needed

it never worked the way you say.
http://flanders.co.nz/2009/10/26/creating-launcher-scripts-for-ironruby/
follow that for the spec and spec.bat file


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
GSM: +32.486.787.582
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

The problem is that my command line does not recognize ispec or rspec or
mspec. it only recognize spec which is basically ruby framework and not
ironruby.

Previously with IronRuby 0.9 I used the following command:

spec test_prime.rb --format nested

and it worked.

Now, when I use spec it executes the ruby framework spec and not
ironruby.

In 0.9 I had to adjust environment variables so that IronRuby spec
command can be executed from anywhere.

Here is my article on that:

http://www.highoncoding.com/Articles/585_Unit_Testing_CLR_Assembly_Using_IronRuby_with_Spec.aspx

there is mspec, rspec, bacon, …

Ironruby uses mspec

The rest of the world (that means just about anything that isn’t a ruby
implementation) uses rspec, shoulda, bacon, test-unit, test-spec, …

All you need to do to run the specs for ironruby is that you have to
execute
dev.bat but I thought we worked out last time that this is probably not
the
best idea, because it’s confusing if you’re not used to working in the
console and with the environment variables.

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

For gems:
Mspec is a simplified version of rspec for testing Ruby implementations.
You shouldn’t be using it unless you are testing a Ruby implementation.
Spec does not exist. I don’t know how you installed it before, but it
doesn’t exist. It is the name of the library that rspec installs
Rspec is the BDD framework for Ruby that you appear to be looking for.

JD

There is mspec, spec, rspec…

In order to run IronRuby specification framework do I have to use rspec.
Also, I think I have to set the ENVIRONMENT variables again for this to
work right??

I don’t like to execute dev.bat each time I need to work with IronRuby.
Why can’t it just work out of the box like PowerShell.

This is a big defect in the IronRuby. Too many configurations will scare
developers away. People are not interested in setting paths in ENV
variables, performing configuration settings in App.config to make sure
that IronRuby is pointing to correct lib paths.

Not many people are willing to try out IronRuby because of configuration
issues.

Does that mean I have to go to the following folder:

C:\DevTools\ironruby-1.0-rc1\lib\ironruby\gems\1.8\gems\rspec-1.3.0\bin

and copy the files into the

C:\DevTools\ironruby-1.0-rc1\bin

folder?

I guess there is no point doing all of this since IronRuby does not
support rCov for code coverage for the .NET CLR assemblies.

Mohammed listen,

If you just extract the ironruby.zip to c:\ironruby and add
C:\ironruby\bin
to your PATH you’re good to go. always, everywhere.

You’re making it out to be harder than it is.

I wrote this earlier but will do it again:
You do igem install rspec
when that completes

copy C:\ironruby\lib\ironruby\gems\bin\spec C:\ironruby\bin\ispec
copy C:\ironruby\lib\ironruby\gems\bin\spec.bat
C:\ironruby\bin\ispec.bat

now you’re good to go.
That wasn’t hard was it.

Now my advice to you is:

  • read a book on shell/batch scripting
  • first check if the problem isn’t PEBKAC/user error/…
  • use google
  • learn properly about ruby and it’s ecosystem and more importantly the
    way
    it works (the secret it’s file based). As it so happens we sell training
    so
    feel free to hire us (http://whiterabbitconsulting.eu).
  • do stuff in piecemeal. start with the most simple thing you can think
    off
  • build your own gem so you know how it works

Did I mention don’t badmouth stuff if the real problem is ignorance.


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
GSM: +32.486.787.582
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

As we’ve talked about before, you only need dev.bat if you are
developing IronRuby. If you are developing with IronRuby, you only need
to use the installer. If you are embedding IronRuby, then there are
app.config issues that need to be worked out, some of those can be
handled by better tooling down the road, some of those can’t be helped.
Even those that can’t be helped have alternate API’s.

JD

Feel free to port rCov to IronRuby to support a) the subset of rCov
written in C. b) adding integration for .NET profiling.

JD

OKay let’s do this step by step. I am failing on step ONE!

C:\Projects\EStudyVS2008\EStudySoltution\EStudy\ConsoleApplication2>igem
install
rspec
ERROR: While executing gem … (RangeError)
bignum too big to convert into Fixnum

What version of IronRuby?

Okay that worked out but I am still not comfortable copying files and
renaming them to batch files and putting them in the bin directory of
the IronRuby folder. Also switching back and forth between the dev.bat
and console. Also, cmd console is not able to find dev.bat from anywhere
so I have to manually execute it from the folder that contains dev.bat.

I am willing to learn IronRuby and spend countless hours using this cool
dynamic language. But I am afraid people are just going to GIVE UP
trying to solve these configuration issues. Setting paths, copying and
renaming their batch files to ispec whatever…

I am not trying to put down IronRuby but sorry this is not going to work
in the real world.

Why are you using dev.bat? Are you developing IronRuby? If not, don’t
use
it. It’s unnecessary unless you are working on or debugging IronRuby.

Ryan R.

Email: [email protected]
LinkedIn: http://www.linkedin.com/in/ryanriley
Blog: http://wizardsofsmart.net/
Twitter: @panesofglass
Website: http://panesofglass.org/

this will change soon when you can do

ir -S spec spec/**/*_spec.rb

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

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