[rspec-users] Using "return" in rspec test

Phlip phlip2005 at gmail.com
Mon May 18 23:23:03 EDT 2009

Gary Lin wrote:

> describe "This tests uses return in my code" do
>  it "should print Hello" do
>      puts "Hello"         # skip some test scenario if product is in 
> demo mode
>      if @product.demoMode?
>          return;

use 'break'

(However, generally speaking, tests should either pass or fail, and they should 
not skip any blocks.)


More information about the rspec-users mailing list