Sha256: 81b5f22af82076af00be12cf194c775e73184e78341e20cb35e839ae371fcf81
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
# -*- encoding : utf-8 -*- require 'spec_helper' describe "Exchange::Cache::Base" do subject { Exchange::Cache::Base.instance } describe "key generation" do before(:each) do time = Time.gm 2012, 03, 01, 23, 23, 23 Time.stub :now => time end context "with a daily cache" do it "should build a timestamped key with the class given, the yearday and the year" do subject.send(:key, :xavier_media).should == 'exchange_xavier_media_2012_61' subject.send(:key, :open_exchange_rates).should == 'exchange_open_exchange_rates_2012_61' end end context "with an hourly cache" do before(:each) do Exchange.configuration.cache.expire = :hourly end after(:each) do Exchange.configuration.cache.expire = :daily end it "should build a timestamped key with the class given, the yearday, the year and the hour" do subject.send(:key, :xavier_media).should == 'exchange_xavier_media_2012_61_23' subject.send(:key, :open_exchange_rates).should == 'exchange_open_exchange_rates_2012_61_23' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems