Sha256: f4a0410717b5d6411b314926695455aed352a36cddf757507c2a6122e77eddc1

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 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

4 entries across 4 versions & 1 rubygems

Version Path
asset_cloud-2.0.0 spec/memory_bucket_spec.rb
asset_cloud-1.1.1 spec/memory_bucket_spec.rb
asset_cloud-1.1.0 spec/memory_bucket_spec.rb
asset_cloud-1.0.2 spec/memory_bucket_spec.rb