Add Job#save to save job info to DB

This commit is contained in:
Dzmitry Plashchynski
2015-03-06 23:41:03 +02:00
parent d0b35aaa6e
commit c54f52a71d
3 changed files with 26 additions and 2 deletions

View File

@@ -25,4 +25,19 @@ describe Crono::Job do
expect(job.description).to be_eql("Perform TestJob every 2 days")
end
end
describe "#save" do
it "should save new job to DB" do
expect(Crono::CronoJob.where(job_id: job.job_id)).to_not exist
job.save
expect(Crono::CronoJob.where(job_id: job.job_id)).to exist
end
it "should update saved job" do
job.last_performed_at = Time.now
job.save
@crono_job = Crono::CronoJob.find_by(job_id: job.job_id)
expect(@crono_job.last_performed_at).to be_eql(job.last_performed_at)
end
end
end