main
1require "spec_helper"
2
3describe CommandProcessor do
4 let(:sut) {CommandProcessor.new }
5
6 context "when run" do
7 let(:first_command) { fake }
8 let(:second_command) { fake }
9 it "should run each command added to the queue" do
10 first_command.should have_received(:run)
11 second_command.should have_received(:run)
12 end
13 before(:each) do
14 sut.add(first_command)
15 sut.add(second_command)
16 sut.run
17 end
18 describe "when run again" do
19 it "should have nothing to run" do
20 first_command.should have_received(:run).once
21 first_command.should have_received(:run).once
22 second_command.should have_received(:run).once
23 end
24 before(:each) do
25 sut.run
26 end
27 end
28 end
29end