Sha256: 8986676c51d2ce47dd169d6b3f8966dea33935bb33c04a45d1f9c9c6f7ccd7c4

Contents?: true

Size: 811 Bytes

Versions: 5

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe Cache do

  it "let you add a cache" do
    cache = Cache.new
    cache.add(:test, :anonymous_cache)
    data = %w{ a b c d}

    expect {
      cache[:test].add data
    }.to_not raise_error
  end

  it "fails if an unknown cache strategy is given" do
    cache = Cache.new
    data = %w{ a b c d}

    expect {
      cache.add(:test, :anonymous_cache_abc)
    }.to raise_error Exceptions::UnknownCachingStrategy 
  end

  it "fails if an unknown cache is given" do
    data = %w{ a b c d}

    expect {
      cache[:test123].add data
    }.to raise_error
  end

  it "returns the cache after adding it" do
    cache = Cache.new
    cache.add(:test, :anonymous_cache)
    data = %w{ a b c d}

    expect( cache[:test].class ).to be(CachingStrategies::AnonymousCache)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
the_array_comparator-0.5.0 spec/cache_spec.rb
the_array_comparator-0.4.0 spec/cache_spec.rb
the_array_comparator-0.3.4 spec/cache_spec.rb
the_array_comparator-0.3.1 spec/cache_spec.rb
the_array_comparator-0.3.0 spec/cache_spec.rb