Sha256: c02386ea4bf9e805b105bd61fd459c450ccf6ac7b97268cdcd83819d6fdfa736
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require_relative '../../../spec_helper' require_relative '../../../../lib/say_when/storage/memory/job' describe SayWhen::Store::Memory::Job do before(:each) do SayWhen::Store::Memory::Job._reset @valid_attributes = { :name => 'Memory::Job::Test', :group => 'Test', :data => {:foo=>'bar', :result=>1}, :job_class => 'SayWhen::Test::TestTask', :job_method => 'execute' } end it "can be instantiated" do j = SayWhen::Store::Memory::Job.new(@valid_attributes) j.should_not be_nil end it "can execute the task for the job" do j = SayWhen::Store::Memory::Job.new(@valid_attributes) j.execute_job({:result=>1}).should == 1 end it "can execute the job" do j = SayWhen::Store::Memory::Job.new(@valid_attributes) j.execute.should == 1 end it "can reset acquired jobs" do j = SayWhen::Store::Memory::Job.new(@valid_attributes) j.status = 'acquired' j.updated_at = 2.hours.ago SayWhen::Store::Memory::Job.reset_acquired(3600) j.status.should == 'waiting' end it "can find the next job" do j = SayWhen::Store::Memory::Job.new(@valid_attributes) next_job = SayWhen::Store::Memory::Job.acquire_next(1.day.since) next_job.should == j end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
say_when-0.4.1 | spec/say_when/storage/memory/job_spec.rb |
say_when-0.4.0 | spec/say_when/storage/memory/job_spec.rb |