Hi,
I'd like to know what's the cleanest way to test that transition callbacks are being triggered.
For instance, how would you test:
before_transition :parked => any - :parked, :do => :put_on_seatbelt
Thanks,
Ben
PS:
From now, I test the transitions this way:
doc.status = "waiting_assignment"
doc.status_transitions.map(&:to).should eq ["in_progress", "paused"]
doc.status = "waiting_assigment"doc.pause.should be_truedoc.should be_pauseddoc.status = "in_progress"doc.wait.should be_falsedoc.should be_in_progress# and so on and so forth...
before_transition :parked => any - :parked, :do => :put_on_seatbelt
vehicle.should_receive(:put_on_seatbelt)vehicle.ignite.should be_true# ...alternatively...vehicle.seatbelt_on = truevehicle.ignite.should be_truevehicle.seatbelt_on.should be_true