From: James Lavin Date: 2011-09-02T12:59:17+09:00 Subject: Re: Testing threads in RSpec Thanks again, Stefano. Your code pretty much matches what I posted originally, but my test was failing. I think I've isolated my problem.... I oversimplified things in my example. My actual program has several moving parts -- Song, UserConfig, Jukebox and system calls -- and I think that's causing my problem. Here's what's supposed to happen: 1) Jukebox is supposed to create a @current_song (which it does) 2) @current_song is asked to play itself (based on @user_config) 3) @current_song then starts a system process (via fork...exec or Spoon.spawnp) to play the actual mp3/ogg file (which it does) 4) Jukebox is supposed to remember what song it's playing, but when I ask Jukebox to tell me the @current_song, it says it's nil. It's as if Jukebox forgets @current_song as soon as it tells @current_song to play I didn't have this problem before I refactored Song out of Jukebox, so I've done something stupid. I'll figure this out tomorrow. --James -- Posted via http://www.ruby-forum.com/.