[rspec-users] Using "return" in rspec test
glin at employees.org
Mon May 18 22:51:12 EDT 2009
I am still new to rspec and I wonder if anyone can give me some insight
about the problem I have encountered. I notice whenever I use "return"
in my test, it will skip all the examples and exit right out of my test
run. Here is a small example that demonstrate the problem:
describe "This tests uses return in my code" do
it "should print Hello" do
# skip some test scenario if product is in demo mode
# rest of the test goes here.
it "should print hi" do
With the above spec, the second "it should print hi" test will never get
I found it would be very useful to use "return" to skip some of the test
code if a particular scenario occurs. So I wonder if I cannot use
"return" to achieve this, is there any way I can workaround it?
More information about the rspec-users