Sha256: 3b146a4066bee77089815c8dc93c8c7eeb27fc538a9fec01f572fb577d51a3bf

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

class MemoryCloud < AssetCloud::Base
  bucket :memory, AssetCloud::MemoryBucket
end

describe AssetCloud::MemoryBucket do
  directory = File.dirname(__FILE__) + '/files'

  before do
    @fs = MemoryCloud.new(directory , 'http://assets/files' )
  end

  describe 'modifying items in subfolder' do

    it "should return nil when file does not exist" do
      @fs['memory/essay.txt'].exist?.should == false
    end

    it "should return set content when asked for the same file" do
      @fs['memory/essay.txt'] = 'text'
      @fs['memory/essay.txt'].value.should == 'text'
    end

  end

  describe "#versioned?" do
    it "should return false" do
      @fs.buckets[:memory].versioned?.should == false
    end
  end

  describe '#ls' do
    before do
      %w{a b}.each do |letter|
        2.times {|number| @fs.write("memory/#{letter}#{number}",'.')}
      end
    end

    it "should return a list of assets which start with the given prefix" do
      @fs.buckets[:memory].ls('memory/a').size.should == 2
    end

    it "should return a list of all assets when a prefix is not given" do
      @fs.buckets[:memory].ls.size.should == 4
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
asset_cloud-2.5.3 spec/memory_bucket_spec.rb
asset_cloud-2.5.2 spec/memory_bucket_spec.rb
asset_cloud-2.5.1 spec/memory_bucket_spec.rb
asset_cloud-2.5.0 spec/memory_bucket_spec.rb
asset_cloud-2.4.0 spec/memory_bucket_spec.rb
asset_cloud-2.3.1 spec/memory_bucket_spec.rb
asset_cloud-2.3.0 spec/memory_bucket_spec.rb
asset_cloud-2.2.9 spec/memory_bucket_spec.rb
asset_cloud-2.2.8 spec/memory_bucket_spec.rb
asset_cloud-2.2.7 spec/memory_bucket_spec.rb
asset_cloud-2.2.6 spec/memory_bucket_spec.rb
asset_cloud-2.2.5 spec/memory_bucket_spec.rb
asset_cloud-2.2.4 spec/memory_bucket_spec.rb
asset_cloud-2.2.2 spec/memory_bucket_spec.rb
asset_cloud-2.2.1 spec/memory_bucket_spec.rb
asset_cloud-2.2.0 spec/memory_bucket_spec.rb
asset_cloud-2.1.0 spec/memory_bucket_spec.rb