Sha256: 452d9282e5d4ef6ef38d24c47b180b64992d6d92bc7d2a5f14cd1b38151b7a31

Contents?: true

Size: 1.04 KB

Versions: 19

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"

describe Redcar::Command::History do
  class HistoryTestCommand1 < Redcar::Command
    def execute
    end
  end
  
  class HistoryTestCommand2 < Redcar::Command
    norecord
    
    def execute
    end
  end
  
  before do
    @history = Redcar::Command::History.new
  end
  
  it "should record executed commands" do
    command = HistoryTestCommand1.new
    @history.record(command)
    @history.length.should == 1
  end
  
  it "should not record norecord commands" do
    command = HistoryTestCommand2.new
    @history.record(command)
    @history.length.should == 0
  end
  
  it "should have a maximum length" do
    @history.max = 5
    10.times { @history.record(HistoryTestCommand1.new) }
    @history.length.should == 5
  end  
  
  it "should record and replace last if required" do
    @history.record(HistoryTestCommand1.new)
    @history.length.should == 1
    new_command = HistoryTestCommand1.new
    @history.record_and_replace(new_command)
    @history.length.should == 1
    @history.last.should == new_command
  end
end



Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
redcar-0.13 plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.5dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.4dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.3dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.2dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.1dev plugins/application/spec/application/command/history_spec.rb
redcar-0.12.1 plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.13.0dev plugins/application/spec/application/command/history_spec.rb
redcar-0.12 plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.27dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.26dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.25dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.24dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.23dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.22dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.21dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.20dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.19dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.18dev plugins/application/spec/application/command/history_spec.rb