spec/gaspar/gaspar_spec.rb in gaspar-0.1.1 vs spec/gaspar/gaspar_spec.rb in gaspar-0.1.2
- old
+ new
@@ -9,10 +9,17 @@
Gaspar.should_receive(:log).with(nil, "Running under a controlling TTY. Refusing to start. Try starting from a daemonized process.")
Gaspar.configure do
every "5m", :Foo
end.start!(redis)
end
+
+ it "should refuse to start if #can_start_if is present and returns false" do
+ Gaspar.configure do
+ can_run_if { false }
+ every "5m", :Foo
+ end.start!(redis)
+ end
end
context "when running in a daemon" do
before(:each) {
STDOUT.stub(:tty?).and_return(false)
@@ -178,10 +185,10 @@
describe "#sync_watches" do
it "should compute drift" do
Time.stub!(:now).and_return(150)
redis = double :redis, :setnx => false, :get => "100", :ttl => (3.2e8.to_i - 25)
instance = Gaspar.send(:new)
- instance.instance_variable_set(:@redis, redis)
+ instance.instance_variable_set(:@redis, redis)
instance.send :sync_watches
instance.drift.should == 25
end
end
end