spec/base_spec.rb in cachedis-0.0.2 vs spec/base_spec.rb in cachedis-0.0.3
- old
+ new
@@ -1,12 +1,12 @@
require 'spec_helper'
-describe Cachedis do
+describe Cachedis::Cacher do
include HelperMethods
before do
- @cachedis = Cachedis.new
+ @cachedis = Cachedis::Cacher.new
end
describe 'when setting something' do
it 'sets without errors' do
with_no_cache(['element', 'element 2'])
@@ -18,36 +18,34 @@
end
end
describe 'when setting and later retrieving something' do
it 'retrieves from redis cache' do
- with_cache('query')
- @cachedis.redis_instance.should_not_receive(:set)
+ with_cache(Marshal.dump('query'))
+ @cachedis.redis.should_not_receive(:set)
- result = @cachedis.cachedis 'expensive-query' do
- "query"
- end
-
- result.should == "query".to_yaml
+ @cachedis.cachedis 'expensive-query' do
+ "query"
+ end
end
end
describe 'when setting additonal redis parameters' do
context 'with one argument' do
it 'sets them in redis' do
with_no_cache
- @cachedis.redis_instance.should_receive(:expire).exactly(1).times
+ @cachedis.redis.should_receive(:expire).exactly(1).times
@cachedis.cachedis 'name', :expire => 60 * 60 do
end
end
end
context 'with an array of arguments' do
it 'sets them in redis' do
with_no_cache
- @cachedis.redis_instance.should_receive(:rename).exactly(1).times
+ @cachedis.redis.should_receive(:rename).exactly(1).times
@cachedis.cachedis 'name', :rename => ['key', 'otherkey'] do
end
end
end