Sha256: 273d1c1e1147478d8ac5a201907fba3828d77313dfc4b608f72c7191677775df
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' describe Docket::RoundRobin do let(:round_robin) { Docket::RoundRobin.new(:storage => $storage) } describe '#set' do it 'sets a list of robins for some identifier key' do round_robin.set("trainer_15", ['dog', 'lion', 'tiger']) expect($storage.db.get('trainer_15')).to be_kind_of(Array) end end describe '#perform' do it "takes the next robin and calls action with it" do action = lambda { |robin| @animal_to_train = robin } round_robin.set("trainer_15", ['dog', 'lion', 'tiger']) round_robin.perform("trainer_15", action) expect(@animal_to_train).to eql('lion') round_robin.perform("trainer_15", action) expect(@animal_to_train).to eql('tiger') round_robin.perform("trainer_15", action) expect(@animal_to_train).to eql('dog') round_robin.perform("trainer_15", action) expect(@animal_to_train).to eql('lion') end it "persists accross sessions" do action = lambda { |robin| @animal_to_train = robin } round_robin.set("trainer_15", ['dog', 'lion', 'tiger']) round_robin.perform("trainer_15", action) reload_storage_connection round_robin = Docket::RoundRobin.new(:storage => $storage) round_robin.perform("trainer_15", action) expect(@animal_to_train).to eql('tiger') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docket-0.0.1 | spec/round_robin_spec.rb |