Sha256: 7c090c0ef306181d8047189a13e349e87bb634a4748ca745ff4907b9799ae1cb

Contents?: true

Size: 737 Bytes

Versions: 11

Compression:

Stored size: 737 Bytes

Contents

require 'spec_helper'

describe Picky::Backends::Memory::JSON do
  
  let(:file) { described_class.new 'some/cache/path/to/file' }
  
  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"
      
      file.dump hash
    end
  end
  
  describe "retrieve" do
    it "raises" do
      lambda do
        file.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
      file.to_s.should == 'Picky::Backends::Memory::JSON(some/cache/path/to/file.memory.json)'
    end
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
picky-3.1.11 spec/lib/backends/memory/json_spec.rb
picky-3.1.10 spec/lib/backends/memory/json_spec.rb
picky-3.1.9 spec/lib/backends/memory/json_spec.rb
picky-3.1.8 spec/lib/backends/memory/json_spec.rb
picky-3.1.7 spec/lib/backends/memory/json_spec.rb
picky-3.1.6 spec/lib/backends/memory/json_spec.rb
picky-3.1.5 spec/lib/backends/memory/json_spec.rb
picky-3.1.4 spec/lib/backends/memory/json_spec.rb
picky-3.1.3 spec/lib/backends/memory/json_spec.rb
picky-3.1.2 spec/lib/backends/memory/json_spec.rb
picky-3.1.1 spec/lib/backends/memory/json_spec.rb