[rspec-users] Use of 'should' in another thread

Rick DeNatale rick.denatale at gmail.com
Thu Jun 12 18:54:31 EDT 2008


On Thu, Jun 12, 2008 at 6:14 PM, Daniel Libanori <daniellibanori at gmail.com>
wrote:

> Hi,
>
>  I've tried to find anything about using 'should' within a Thread, but
> it is a little hard do look up there, so I hope you forgive-me if I am
> asking an "old question".
>
>  I guess this spec should fail:
>
> describe Thread do
>  it "must be fine" do
>    Thread.new { true.should_not be_true } # Why don't fail?!
>  end
> end
>

No, it's because you aren't waiting for the thread.  Try:

describe Thread do
 it "must be fine" do
  t = Thread.new { true.should_not be_true }
  t.join
 end
end

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080612/f1793941/attachment.html>


More information about the rspec-users mailing list