summaryrefslogtreecommitdiff
path: root/spec/command_processor_specs.rb
blob: 0d47f3a0d5900cc6fb8a3aa562c7993d02730b76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require "command_processor"

describe CommandProcessor do
  before(:each) do
    @sut = CommandProcessor.new
  end
  describe "when run" do
    it "should run each command added to the queue" do
      @first_command.received(:run).wont_be_nil
      @second_command.received(:run).wont_be_nil
    end
    before do
      @first_command = fake
      @second_command = fake
      @sut.add(@first_command)
      @sut.add(@second_command)
      @sut.run
    end
    describe "when run again" do
      it "should have nothing to run" do
        @first_command.received(:run).times?(1).must_equal true
        @second_command.received(:run).times?(1).must_equal true
      end
      before(:each) do
        @sut.run
      end
    end
  end
end