From: Stefano Crocco Date: 2011-09-01T03:55:06+09:00 Subject: Re: Testing threads in RSpec On Thursday 01 September 2011 03:45:17 James Lavin wrote: > it "should have a current_song" do > thread = Thread.new do > Jukebox.play # forks a music process and waits till > completion > end > sleep 0.1 > Jukebox.current_song.is_a?(Song) > end You should try putting thread.join instead of sleep. That makes the main thread wait for the thread to return before going on. See the ri documentation for Thread#join for more information. I hope this helps Stefano