Sha256: e9bba1be88e8633e73b5d45e30f1139c94fdbc9f1cd43fb4e1fd9b91321393b9
Contents?: true
Size: 1.91 KB
Versions: 12
Compression:
Stored size: 1.91 KB
Contents
require 'spec_helper' describe Internals::Index::Redis do let(:config) do index = stub :index, :name => :some_index category = stub :category, :name => :some_category Configuration::Index.new index, category end let(:redis) { described_class.new :some_name, config } describe 'setting' do it 'delegates to the configuration' do configuration = stub :configuration redis.stub! :configuration => configuration configuration.should_receive(:member).once.with :some_sym redis.setting :some_sym end it 'returns the value' do configuration = stub :configuration redis.stub! :configuration => configuration configuration.should_receive(:member).any_number_of_times.and_return "some config" redis.setting(:any).should == "some config" end end describe 'weight' do it 'delegates to the weights' do weights = stub :weights redis.stub! :weights => weights weights.should_receive(:member).once.with :some_sym redis.weight :some_sym end it 'returns a floated value' do weights = stub :weights redis.stub! :weights => weights weights.should_receive(:member).any_number_of_times.and_return "1.0" redis.weight(:any).should == 1.0 end it 'returns a floated value' do weights = stub :weights redis.stub! :weights => weights weights.should_receive(:member).any_number_of_times.and_return 1 redis.weight(:any).should == 1.0 end end describe 'ids' do it 'delegates to the index' do index = stub :index redis.stub! :index => index index.should_receive(:collection).once.with :some_sym redis.ids :some_sym end it 'returns the value' do index = stub :index redis.stub! :index => index index.should_receive(:collection).any_number_of_times.and_return [1,2,3] redis.ids(:any).should == [1,2,3] end end end
Version data entries
12 entries across 12 versions & 1 rubygems