Sha256: 18a280655421d5881893cc232587a4fd6c7947456b18a6c33e26a8f83a0e4af0
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' describe "Exchange::Cache::Base" do subject { Exchange::Cache::Base } 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 Exchange::Cache::Base.send(:key, :xavier_media).should == 'exchange_xavier_media_2012_61' Exchange::Cache::Base.send(:key, :currency_bot).should == 'exchange_currency_bot_2012_61' end end context "with an hourly cache" do before(:each) do Exchange::Configuration.update = :hourly end after(:each) do Exchange::Configuration.update = :daily end it "should build a timestamped key with the class given, the yearday, the year and the hour" do Exchange::Cache::Base.send(:key, :xavier_media).should == 'exchange_xavier_media_2012_61_23' Exchange::Cache::Base.send(:key, :currency_bot).should == 'exchange_currency_bot_2012_61_23' end end end end
Version data entries
5 entries across 5 versions & 1 rubygems