[rspec-devel] [ rspec-Feature Requests-4462 ] Ability to use RSpec without the runner
noreply at rubyforge.org
noreply at rubyforge.org
Tue Dec 5 02:18:19 EST 2006
Feature Requests item #4462, was opened at 2006-05-13 04:53
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=4462&group_id=797
Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Suraj Kurapati (snk)
Assigned to: Nobody (None)
Summary: Ability to use RSpec without the runner
Initial Comment:
Hello,
I was previously using the Ruby test/unit framework with a Ruby interpreter embedded inside a C program. In such a situation, I am unable to use an external runner program to bootstrap the Ruby interpreter, and I need the ability to work the other way around: bootstrap RSpec from within Ruby.
This problem was discussed and solved (see attached file) at [ruby-talk: 192569].
Thanks for your attention.
----------------------------------------------------------------------
>Comment By: Suraj Kurapati (snk)
Date: 2006-12-05 07:18
Message:
Please see the new file (updated for rSpec 0.7.2).
> Do you want us to add this file to RSpec's svn? Where?
Yes. Please add it to SVN as (my suggestion):
lib/rspec/runner.rb
If you do that, then people can use rSpec from within Ruby
by writing:
require 'rubygems'
require 'rspec'
require 'rspec/runner'
context "..." do
specify "..." do
# ...
end
end
----------------------------------------------------------------------
Comment By: Suraj Kurapati (snk)
Date: 2006-05-20 01:40
Message:
> Do you want us to add this file to RSpec's svn? Where?
Perhaps not this exact file (I'm not sure it meets your
coding standards), but something similar.
> How does it compare to spec.rb?
spec.rb doesn't allow simply 'require'ing or 'load'ing it to
use RSpec:
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'rspec'
=> true
irb(main):003:0> require 'spec'
=> false
irb(main):004:0> load 'spec'
Usage: spec [options] (FILE|DIRECTORY)+
-b, --backtrace Output full backtrace
-f, --format FORMAT Output format
(specdoc|s|rdoc|r)
-d, --dry-run Don't execute specs
-s, --spec SPECIFICATION_NAME Execute a single
specification
-v, --version Show version
-h, --help Show this message
I am looking for functionality like test/unit, where simply
'require'ing that library will bootstrap it upon exit:
irb(main):001:0> require 'test/unit'
=> true
irb(main):002:0> quit
Loaded suite irb
Started
Finished in 0.000675 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
/usr/lib/ruby/1.8/irb.rb:76:in `throw': uncaught throw
`IRB_EXIT' (NameError)
from /usr/lib/ruby/1.8/irb.rb:76:in `irb_exit'
from /usr/lib/ruby/1.8/irb/context.rb:226:in `exit'
from /usr/lib/ruby/1.8/irb/extend-command.rb:24:in `exit'
from /usr/lib/ruby/1.8/test/unit.rb:285
from /usr/bin/irb:13
> Can you give some more examples about how and when it's used?
Please see the attached file. It is executed by a Ruby
interpreter embedded inside a C program (a Verilog simulator
in this case). It is essential to have the ability to
bootstrap the RSpec library from within the attached file
(like test/unit bootstaps itself just by being 'require'd).
Thanks for your consideration.
----------------------------------------------------------------------
Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2006-05-18 18:50
Message:
Do you want us to add this file to RSpec's svn? Where?
How does it compare to spec.rb?
Can you give some more examples about how and when it's used?
For future reference - the ruby-talk link is http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192569
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=4462&group_id=797
More information about the rspec-devel
mailing list