Sha256: 772a09d287bc1c2a5cb9ca1d26e5f220674eb0e175f8731452e67d609a4604de

Contents?: true

Size: 1014 Bytes

Versions: 14

Compression:

Stored size: 1014 Bytes

Contents

require 'spec_helper'

describe Picky::Backends::Memory::JSON do
  
  context 'hash-based indexes' do
    let(:json) { described_class.new 'some/cache/path/to/file' }

    describe 'extension' do
      it 'is correct' do
        json.extension.should == :json
      end
    end

    describe 'initial' do
      it 'is correct' do
        json.initial.should == {}
      end
    end

    describe "dump" do
      it "delegates to the given hash" do
        hash = stub :hash

        hash.should_receive(:dump_json).once.with "some/cache/path/to/file.memory.json"

        json.dump hash
      end
    end

    describe "retrieve" do
      it "raises" do
        lambda do
          json.retrieve
        end.should raise_error("Can't retrieve from JSON file. Use text file.")
      end
    end

    describe 'to_s' do
      it 'returns the cache path with the default file extension' do
        json.to_s.should == 'Picky::Backends::Memory::JSON(some/cache/path/to/file.memory.json)'
      end
    end
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
picky-3.5.2 spec/lib/backends/memory/json_spec.rb
picky-3.5.1 spec/lib/backends/memory/json_spec.rb
picky-3.5.0 spec/lib/backends/memory/json_spec.rb
picky-3.4.3 spec/lib/backends/memory/json_spec.rb
picky-3.4.2 spec/lib/backends/memory/json_spec.rb
picky-3.4.1 spec/lib/backends/memory/json_spec.rb
picky-3.4.0 spec/lib/backends/memory/json_spec.rb
picky-3.3.3 spec/lib/backends/memory/json_spec.rb
picky-3.3.2 spec/lib/backends/memory/json_spec.rb
picky-3.3.1 spec/lib/backends/memory/json_spec.rb
picky-3.3.0 spec/lib/backends/memory/json_spec.rb
picky-3.2.0 spec/lib/backends/memory/json_spec.rb
picky-3.1.13 spec/lib/backends/memory/json_spec.rb
picky-3.1.12 spec/lib/backends/memory/json_spec.rb