Probably something like in your scheduler initializer:
if Rails.env.production?
# start scheduler and schedule stuff...
end
EDIT
If you want to avoid running the scheduler in presence of Rspec you can do
if !defined?(Rspec)
# start scheduler and schedule stuff...
end
It's a bit sad to mention the test framework in the code itself. It's probably better to say "let's not run the scheduler in test mode and do:
if !Rails.env.test?
# start scheduler and schedule stuff...
end
So that the scheduler will run in production and development (or whatever env that is not test).