Sha256: a839456a05e2be7a98f3dddd013bbeb078c93593ca1ca4472410192832606491

Contents?: true

Size: 938 Bytes

Versions: 5

Compression:

Stored size: 938 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

module Cucover
  describe Store do
    before(:each) do
      @cache = mock('cache', :load => nil)
      @store = Store.new(@cache)
    end
    describe "#latest_recording" do
      it "should return nil if no recordings match the given identifier" do
        @store.latest_recording('blah:234').should be_nil
      end
      
      describe "when multiple recordings match the given indentifier" do
        before(:each) do
          old_recording = mock('old data', :end_time => Time.now - 200)
          @new_recording = mock('new data', :end_time => Time.now)
          @cache.stub!(:load).and_return({
            'foo.feature:33' => [ old_recording, @new_recording ] 
          })
        end
        it "should return the one with the latest end_time" do
          @store.latest_recording('foo.feature:33').should == @new_recording
        end        
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
mattwynne-cucover-0.1.0 spec/cucover/store_spec.rb
mattwynne-cucover-0.1.1 spec/cucover/store_spec.rb
cucover-0.1.4 spec/cucover/store_spec.rb
cucover-0.1.3 spec/cucover/store_spec.rb
cucover-0.1.2 spec/cucover/store_spec.rb