I have this code trying to ensure my reset method works. I want to make sure all the participants have their destroy method called.

# in my spec for Room
    r = Room.new(:name => 'bob')
    r.save

p = Participant.new(:login => 'a', :password => 'b', :password_confirmation => 'b')
    p.room = r
    p.save!
    p.should_receive(:destroy)

    r.reset

#in room.rb
  def reset
    participants.each { |p| p.destroy }
    save!
  end

Unfortunately it fails. I print out "p" in both locations and while they have all the same data, they have different memory addresses. I don't know if this is the explanation for the issue but it's all I can find so far.

How do I fix this?  Thanks!

Glenn
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to