Sha256: c6a082ce1cd71453a77d0560dae4095efa0e99a191361a421a30fcebbff3af9b

Contents?: true

Size: 1.37 KB

Versions: 26

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

describe "Writing through to cache on create" do
  before do
    @address = Address.create :street => "Spooner"
  end
  
  it "writes through to memcache using the model street and guid as cache key" do
    $cache.get("Address/0/#{@address.id.to_guid}").should == @address
  end
end

describe "Writing with a version number" do
  before do
    Address.storage_proxy.caches.clear
    Address.caches_by :id, :version => 1
    @address = Address.create :street => "Spooner"
  end

  after do
    Address.storage_proxy.caches.clear
    Address.caches_by :id
  end

  it "adds the version number to the cache key" do
    $cache.get("Address/1/#{@address.id.to_guid}").should == @address
  end
end

describe "Writing through to cache on update" do
  before do
    @address = Address.create :street => "Spooner"
    @address.street = "Joe"
    @address.save
  end
  
  it "writes through to memcache using the model street and guid as cache key" do
    $cache.get("Address/0/#{@address.id.to_guid}").street.should == @address.street
  end
end

describe "Writing through to cache on destroy" do
  before do
    @address = Address.create :street => "Spooner"
    @address.destroy
  end
  
  it "removes the object from cache" do
    lambda {
      $cache.get("Address/0/#{@address.id.to_guid}") 
    }.should raise_error(Memcached::NotFound)
  end
end

Version data entries

26 entries across 26 versions & 7 rubygems

Version Path
ihoka-friendly-0.8.0.pre spec/integration/write_through_cache_spec.rb
ihoka-friendly-0.7.1.2 spec/integration/write_through_cache_spec.rb
ihoka-friendly-0.7.1.1 spec/integration/write_through_cache_spec.rb
ihoka-friendly-0.7.1 spec/integration/write_through_cache_spec.rb
ihoka-friendly-0.7.0 spec/integration/write_through_cache_spec.rb
friendly-0.6.0 spec/integration/write_through_cache_spec.rb
honkster-friendly-0.5.3 spec/integration/write_through_cache_spec.rb
honkster-friendly-0.5.2 spec/integration/write_through_cache_spec.rb
honkster-friendly-0.5.1 spec/integration/write_through_cache_spec.rb
wayne-friendly-0.5.1 spec/integration/write_through_cache_spec.rb
wego-friendly-0.5.1 spec/integration/write_through_cache_spec.rb
arunthampi-friendly-0.5.1 spec/integration/write_through_cache_spec.rb
friendly_postgres-0.5.1 spec/integration/write_through_cache_spec.rb
friendly-0.5.1 spec/integration/write_through_cache_spec.rb
friendly-0.5.0 spec/integration/write_through_cache_spec.rb
friendly_postgres-0.4.5 spec/integration/write_through_cache_spec.rb
friendly-0.4.5 spec/integration/write_through_cache_spec.rb
friendly-0.4.4 spec/integration/write_through_cache_spec.rb
friendly_postgres-0.4.3 spec/integration/write_through_cache_spec.rb
friendly-0.4.3 spec/integration/write_through_cache_spec.rb