title: Handling several event listeners
body: <p><strong>Update: here's a fiddle of my problem. The tests pass once, and fail the next time:</strong></p>
  
  <p><a href="http://jsfiddle.net/samselikoff/hhk6u/4/" rel="nofollow">http://jsfiddle.net/samselikoff/hhk6u/4/</a></p>
  
  <p>The problem is <code>departments</code> has <code>events.on("userSet:company")</code>, so both variables respond to the event.</p>
  
  <hr>
  
  <p>This is a general question about unit testing. In my app, a certain event is fired, and several other pieces of my app listen for this event. I'd like to unit test each piece separately, since they are performing different functions; but to do this, I have to fire off the event in each test.</p>
  
  <p>This causes problems, since the first test must fire off the event, triggering the listeners in the other tests. How can I keep my tests atomic while still testing multiple event listeners?</p>
  
  <p>(I am using QUnit, but I think this is a more general unit-testing question).</p>
  
  <p><strong>Answer:</strong></p>
  
  <p>Jeferson is correct. One easy way to solve this, is to use events.once instead of events.on. This way you clean up your events from each test.</p>