require_relative "./helpers" describe BigBench::Store do before(:each) do BigBench::Store.reset! Dir.chdir File.dirname(__FILE__) end it "should setup properly" do BigBench::Store.setup!("http://localhost:6379").should be_true end it "should supply a method to store a test receipts" do test = File.open("tests/local.rb", "rb"){ |file| file.read } BigBench::Store.test = test BigBench::Store.test.should == test end it "should supply a method to global start a test" do test = File.open("tests/local.rb", "rb"){ |file| file.read } BigBench::Store.start BigBench::Store.running?.should == true BigBench::Store.stop BigBench::Store.running?.should == false end it "should allow bots to add and change their status" do id, id2 = "8746528kbvs", "dsfoiasdgf" BigBench::Store.bot_is_working(id) BigBench::Store.bot_is_working(id2) BigBench::Store.bots.size.should == 2 BigBench::Store.bot_stopped_working(id) BigBench::Store.bots.size.should == 1 BigBench::Store.bot_stopped_working(id2) BigBench::Store.bots.size.should == 0 end it "should allow to append trackings" do BigBench::Store.setup!("http://localhost:6379").should be_true BigBench::Store.add_tracking "Number 1" BigBench::Store.add_tracking "Number 2" BigBench::Store.add_tracking "Number 3" BigBench::Store.add_tracking "Number 4" BigBench::Store.count_trackings.should == 4 BigBench::Store.pop_tracking.should == "Number 1" BigBench::Store.pop_tracking.should == "Number 2" BigBench::Store.pop_tracking.should == "Number 3" BigBench::Store.pop_tracking.should == "Number 4" end it "should allow to reset all values" do BigBench::Store.setup!("http://localhost:6379").should be_true test = File.open("tests/local.rb", "rb"){ |file| file.read } BigBench::Store.test = test BigBench::Store.start BigBench::Store.reset! BigBench::Store.running?.should == false BigBench::Store.test.should == nil BigBench::Store.bots.should be_empty end end