From: "Suraj N. Kurapati" Date: 2006-05-13T08:09:09+09:00 Subject: using RSpec without runner - inconsistent context evaluation -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I'm trying to use RSpec 0.5.3 with Ruby 1.8.4 in an embedded situation: (C program | (Ruby interpreter | | (RSpec library | | ... my specification ... | | ) | ) ) Here I have an embedded Ruby interpreter which can run any Ruby file, but I do not have the ability to use the RSpec runner because it only works with this kind of situation: (RSpec runner | (Ruby interpreter | | ... my specification ... | ) ) The only way I know to solve this problem is invoking the RSpec library directly through through RubyGems' "require" method: ### begin stack_spec.rb ### require 'rubygems' require_gem 'rspec' require 'spec' context "A new stack" do specify "should be empty" do end end context "An empty stack" do specify "should not be empty after 'push'" do end end ### end stack_spec.rb ### However, the evaluation of the contexts is different when I use the RSpec library directly (as with the stack_spec.rb above) and when I use the RSpec runner: ### begin output ### $ spec stack_spec.rb .. Finished in 0.000854 seconds 2 contexts, 2 specifications, 0 failures $ ruby stack_spec.rb . Finished in 0.000582 seconds 1 context, 1 specification, 0 failures . Finished in 0.000531 seconds 1 context, 1 specification, 0 failures ### end output ### How can I use the RSpec library directly (through "require" or some other means) and still get the same behavior as if I used the RSpec runner? Thanks for your attention. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEZRWFmV9O7RYnKMcRArc+AJ9tA3OxNiyukSseRRcUc1FzKJk3UwCfdm9u wVR2dap5kdBXj+uVh0qkiBI= =05Qn -----END PGP SIGNATURE-----