Sha256: 41fc3136cb845abf2cb67a55f6590daf4f2945a27a286b9187d5b2e43927486a

Contents?: true

Size: 996 Bytes

Versions: 25

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

describe Picky::Backends::Memory::JSON do

  context 'hash-based indexes' do
    let(:json) { described_class.new 'spec/temp/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 "forwards to the given hash" do
        hash = stub :hash

        json.should_receive(:dump_json).once.with hash

        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(spec/temp/some/cache/path/to/file.memory.json)'
      end
    end
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-4.19.4 spec/lib/backends/memory/json_spec.rb
picky-4.19.3 spec/lib/backends/memory/json_spec.rb
picky-4.19.2 spec/lib/backends/memory/json_spec.rb
picky-4.19.1 spec/lib/backends/memory/json_spec.rb
picky-4.19.0 spec/lib/backends/memory/json_spec.rb
picky-4.18.0 spec/lib/backends/memory/json_spec.rb
picky-4.17.1 spec/lib/backends/memory/json_spec.rb
picky-4.17.0 spec/lib/backends/memory/json_spec.rb
picky-4.16.0 spec/lib/backends/memory/json_spec.rb
picky-4.15.1 spec/lib/backends/memory/json_spec.rb
picky-4.15.0 spec/lib/backends/memory/json_spec.rb
picky-4.14.0 spec/lib/backends/memory/json_spec.rb
picky-4.13.1 spec/lib/backends/memory/json_spec.rb
picky-4.13.0 spec/lib/backends/memory/json_spec.rb
picky-4.12.13 spec/lib/backends/memory/json_spec.rb
picky-4.12.12 spec/lib/backends/memory/json_spec.rb
picky-4.12.11 spec/lib/backends/memory/json_spec.rb
picky-4.12.10 spec/lib/backends/memory/json_spec.rb
picky-4.12.8 spec/lib/backends/memory/json_spec.rb
picky-4.12.7 spec/lib/backends/memory/json_spec.rb