Sha256: acab07d6cffcaf133f7bf0ab7a961bf221d1afeeb50099c35210f6c4ca5e5ada

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe "data_store", :shared => true do

  # Using these shared spec requires you to set the inst var @data_store
  
  before(:each) do
    @temp_object = Dragonfly::TempObject.new('gollum')
  end

  describe "store" do
    it "should return a unique identifier for each storage" do
      @data_store.store(@temp_object).should_not == @data_store.store(@temp_object)
    end
  end
  
  describe "retrieve" do
    it "should retrieve the stored data" do
      uid = @data_store.store(@temp_object)
      Dragonfly::TempObject.new(@data_store.retrieve(uid)).data.should == @temp_object.data
    end

    it "should raise an exception if the data doesn't exist" do
      lambda{
        @data_store.retrieve('gooble/gubbub')
      }.should raise_error(Dragonfly::DataStorage::DataNotFound)
    end
  end
  
  describe "destroy" do
    
    it "should destroy the stored data" do
      uid = @data_store.store(@temp_object)
      @data_store.destroy(uid)
      lambda{
        @data_store.retrieve(uid)
      }.should raise_error(Dragonfly::DataStorage::DataNotFound)
    end
    
    it "should raise an error if the data doesn't exist" do
      lambda{
        @data_store.destroy('gooble/gubbub')
      }.should raise_error(Dragonfly::DataStorage::DataNotFound)
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dragonfly-0.3.4 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.3.3 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.3.2 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.3.0 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.2.1 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.1.6 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.1.5 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.1.4 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.1.1 spec/dragonfly/data_storage/data_store_spec.rb
dragonfly-0.1.0 spec/dragonfly/data_storage/data_store_spec.rb