Sha256: 051efa3e8d76e53c66def5a33a5518f4c32b12e72c10ee0c5b8d5b9a9d429ef0
Contents?: true
Size: 833 Bytes
Versions: 5
Compression:
Stored size: 833 Bytes
Contents
require "spec_helper" describe Chrono::Trigger do let(:trigger) do described_class.new(source, &block) end let(:source) do "* * * * *" end let(:block) do -> {} end describe "#once" do it "waits till scheduled time and then triggers a given job only once" do expect(block).to receive(:call) expect(trigger).to receive(:sleep) trigger.once end end # Stub Trigger#loop behavior to avoid blocking main process. describe "#run" do before do allow(trigger).to receive(:loop) do |&block| 2.times do block.call end end end it "waits till scheduled time and then triggers a given job periodically" do expect(block).to receive(:call).twice expect(trigger).to receive(:sleep).twice trigger.run end end end
Version data entries
5 entries across 5 versions & 1 rubygems