Sha256: 4dd93e37f882710adc607b5edd9610c380f3a54c77e07bd09582b688a04f0f1f

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

require 'spec_helper'

describe FileScheduler::Log do
  
  let(:content) { mock }

  def another_content
    mock
  end

  describe "#distance" do
    
    it "should be nil when content is unknown" do
      subject.distance(mock).should be_nil
    end

    it "should be zero when content has been logged just before" do
      subject.log(content)
      subject.distance(content).should be_zero
    end

    it "should be increase each time another content is logged" do
      subject.log(content)
      5.times { subject.log another_content }
      subject.distance(content).should == 5
    end
    
  end

  describe "#log" do
    
    it "should returh the logged content" do
      subject.log(content).should == content
    end

  end

  describe "#max_size" do
    
    it "should limit the number of reminded contents" do
      subject.max_size = 10
      subject.log(content)
      10.times { subject.log another_content }
      subject.distance(content).should be_nil
    end

  end
  

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
file_scheduler-0.0.2 spec/lib/file_scheduler/log_spec.rb