Sha256: 43257d3afd85932c351f8b2a509b2dcf7006a8c4693c8d065d3df587afdb10f8
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "HashPersistent::Counter" do context "when mixed-in to a class" do before(:each) do class CounterFoo include HashPersistent::Counter end end it "should impart a next_key class method" do CounterFoo.respond_to?(:next_key).should be_true end it "should supply a new key on each next_key call" do CounterFoo.next_key.should_not == CounterFoo.next_key end it "should be careful when incrementing the key in multi-threaded/process environment" end context "when mixed-in to more than one class" do before(:each) do class CounterFred include HashPersistent::Counter end class CounterBarney include HashPersistent::Counter end end it "should count independently for each class" do CounterFred.next_key.should == CounterBarney.next_key CounterFred.next_key.should == CounterBarney.next_key end end end
Version data entries
5 entries across 5 versions & 1 rubygems