Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Test]
public function command_dispatches_completed_when_all_sync_commands_complete():void
{
var command:CompositeSignalCommand = getCompositeSignalCommandWithThreeSubCommands();
var completedSignal:VerifyDispatchSignal = new VerifyDispatchSignal();
command.completed = completedSignal;
command.execute();
assertThat(completedSignal.dispatched, isTrue());
}
private function getCompositeSignalCommandWithThreeSubCommands():CompositeSignalCommand
{
var command:CompositeSignalCommand = new CompositeSignalCommand();
command.reflector = new SwiftSuspendersReflector();
command.injector = context.getInjector();
command.signalCommandMap = new SignalCommandMap(command.injector);
command.addCommand(TestCompleteSyncCommand);
command.addCommand(TestCompleteSyncCommand);
command.addCommand(TestCompleteSyncCommand);
return command
}
package org.robotlegs.test.support
{
import org.osflash.signals.Signal;
public class VerifyDispatchSignal extends Signal
{
public var dispatched:Boolean;
override public function dispatch(... rest):void
{
dispatched = true;
super.dispatch(rest);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment