Created
March 8, 2012 18:01
-
-
Save ticktricktrack/2002373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyJob | |
@queue = :my_queue | |
def self.perform(args) | |
puts 'Job starting' | |
puts 'whoohooo' | |
end | |
end | |
my_job_hourly: | |
cron: "0 * * * *" | |
class: MyJob | |
description: "This runs every hour" | |
args: "hourly" | |
describe "MyJob" do | |
def start_scheduled(name) | |
config = Resque.schedule[name] | |
Resque::Scheduler.enqueue_from_config(config) | |
end | |
it "schedules the job" do | |
Resque.enqueue_in(1.hour, MyJob, '123') | |
MyJob.should have_schedule_size_of(1) | |
MyJob.should have_scheduled('123MISPELLED').in(1.hour) | |
end | |
it "runs the job" do | |
MyJob.should have_queue_size_of(0) | |
MyJob.should have_scheduled('hourly') | |
start_scheduled('my_job_hourly') | |
MyJob.should have_queue_size_of(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment