Sha256: 30c7becdc886441d13f4966466c4727f080ee67474c30787d82731aaa7908944

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

require 'spec_helper'

describe FastSerializer do
  
  it "should be able to set and get a global cache" do
    expect(FastSerializer.cache).to eq nil
    begin
      FastSerializer.cache = :mock
      expect(FastSerializer.cache).to eq :mock
    ensure
      FastSerializer.cache = nil
    end
    expect(FastSerializer.cache).to eq nil
  end
  
  it "should set the cache to Rails.cache with the value :rails" do
    begin
      rails = double(:cache => :rails_cache)
      stub_const("Rails", rails)
      FastSerializer.cache = :rails
      expect(FastSerializer.cache).to be_a FastSerializer::Cache::ActiveSupportCache
      expect(FastSerializer.cache.cache).to eq :rails_cache
    ensure
      FastSerializer.cache = nil
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fast_serializer-1.0.1 spec/fast_serializer_spec.rb
fast_serializer-1.0.0 spec/fast_serializer_spec.rb