Sha256: 2c013d78089e544c0a6825ab1f2fe5d97e50518b03c8c0ff38b2a9071a1a1a98

Contents?: true

Size: 1.09 KB

Versions: 60

Compression:

Stored size: 1.09 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "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

60 entries across 60 versions & 2 rubygems

Version Path
redcar-dev-0.12.17dev plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.16dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.15dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.14dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.13dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.12dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.11dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.10dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.9dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.8dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.7dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.6dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.4dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.3dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.1dev-java plugins/application/spec/application/command/history_spec.rb
redcar-dev-0.12.0dev-java plugins/application/spec/application/command/history_spec.rb
redcar-0.11 plugins/application/spec/application/command/history_spec.rb
redcar-0.11.0dev plugins/application/spec/application/command/history_spec.rb
redcar-0.10 plugins/application/spec/application/command/history_spec.rb
redcar-0.9.2 plugins/application/spec/application/command/history_spec.rb