Sha256: 4cfa97f12108f2336323717301ee7d1c57c6d514095edab2c11c45ce6cd781bf

Contents?: true

Size: 1.6 KB

Versions: 13

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Picky::Backends::File::Basic do
  
  context 'without options' do
    let(:basic) { described_class.new 'some/cache/path/to/file' }

    describe 'empty' do
      it 'returns the container that is used for indexing' do
        basic.empty.should == {}
      end
    end
    
    describe 'initial' do
      it 'returns the container that is used for indexing' do
        basic.initial.should == nil
      end
    end

    describe 'backup_file_path_of' do
      it 'returns a backup path relative to the path' do
        basic.backup_file_path_of('some/path/to/some.memory.index').should == 'some/path/to/backup/some.memory.index'
      end
    end
  
    describe 'backup_directory' do
      it "returns the cache path's backup path" do
        basic.backup_directory('some/cache/path/to/file').should == 'some/cache/path/to/backup'
      end
    end
  
    describe 'to_s' do
      it 'returns the cache path with the default file extension' do
        basic.to_s.should == 'Picky::Backends::File::Basic(some/cache/path/to/file.file.index,some/cache/path/to/file.file_mapping.index.memory.json)'
      end
    end
  end
  
  context 'with options' do
    let(:basic) do
      described_class.new 'some/cache/path/to/file',
                          empty: [],
                          initial: []
    end

    describe 'empty' do
      it 'returns the container that is used for indexing' do
        basic.empty.should == []
      end
    end
    
    describe 'initial' do
      it 'returns the container that is used for indexing' do
        basic.initial.should == []
      end
    end
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
picky-3.5.4 spec/lib/backends/file/basic_spec.rb
picky-3.5.3 spec/lib/backends/file/basic_spec.rb
picky-3.5.2 spec/lib/backends/file/basic_spec.rb
picky-3.5.1 spec/lib/backends/file/basic_spec.rb
picky-3.5.0 spec/lib/backends/file/basic_spec.rb
picky-3.4.3 spec/lib/backends/file/basic_spec.rb
picky-3.4.2 spec/lib/backends/file/basic_spec.rb
picky-3.4.1 spec/lib/backends/file/basic_spec.rb
picky-3.4.0 spec/lib/backends/file/basic_spec.rb
picky-3.3.3 spec/lib/backends/file/basic_spec.rb
picky-3.3.2 spec/lib/backends/file/basic_spec.rb
picky-3.3.1 spec/lib/backends/file/basic_spec.rb
picky-3.3.0 spec/lib/backends/file/basic_spec.rb