Sha256: bc58fa4cd2f575c9e976c0e5a74d2070e7402ea0f6766ac4250eb68617bf77be

Contents?: true

Size: 717 Bytes

Versions: 7

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

describe Picky::Backend::File::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.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::Backend::File::JSON(some/cache/path/to/file.json)'
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
picky-3.0.1 spec/lib/backend/file/json_spec.rb
picky-3.0.0 spec/lib/backend/file/json_spec.rb
picky-3.0.0.pre5 spec/lib/backend/file/json_spec.rb
picky-3.0.0.pre4 spec/lib/backend/file/json_spec.rb
picky-3.0.0.pre3 spec/lib/backend/file/json_spec.rb
picky-3.0.0.pre2 spec/lib/backend/file/json_spec.rb
picky-3.0.0.pre1 spec/lib/backend/file/json_spec.rb