Skip to content

Commit

Permalink
ensure a transition can be run from a method reference on another object
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomanhaes committed Sep 5, 2011
1 parent e563b53 commit d66d733
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/xfluidity_spec.py
Expand Up @@ -28,8 +28,9 @@ def exit_light(self):
def enter_light(self):
self.pass_light = True

def boom(self):
def boom(self, param=None):
self.is_destroyed = True
self.boom_param = param


class DoorWannabe(object):
Expand Down Expand Up @@ -78,3 +79,10 @@ def it_can_get_rid_of_state_machine_stuff(self):
self.door_wannabe |should_not| respond_to('crack')
self.door_wannabe |should_not| respond_to('close')

def it_runs_action_from_a_reference_on_another_object(self):
anyone = type('object', (), {})()
anyone.transition = self.door.crack
anyone.transition('own3d')
self.door.boom_param |should| equal_to('own3d')
self.door.current_state |should| equal_to('broken')

0 comments on commit d66d733

Please sign in to comment.