Open mrvovanness opened 9 years ago
Hi @mrvovanness,
Try removing the require
option from your Gemfile
. The latest README
of resque-scheduler indicates that it is not needed. If that works, ping back and I will update the _resquespec README
.
Hello @leshill!
I removed the require option and that works. But whenever I trigger scheduling in my test it shows me that my schedule size is 0, but actually in development and production mode scheduling works perfect. For example, when I create new instance of `Survey' this triggers the creation of new schedule via callback:
#...
after_save :schedule_send_emails
def schedule_send_emails
config[:every] = '1w'
name = "send_emails_for_survey_#{id}"
config[:class] = 'SendEmailsJob'
config[:queue] = 'send_emails'
config[:persist] = true
config[:args] = id
Resque.set_schedule(name, config)
end
but when I test this:
it 'create schedule on #save' do
survey.save
expect(SendEmailsJob).to have_schedule_size_of(1)
end
I have error expected that SendEmailsJob would have 1 s cheduled entries, but got 0 instead
I have no idea what I am doing wrong
For now I just end up requesting test Redis database:
it 'create schedule on #save' do
survey.save
expect(Resque.schedule_persisted?("send_emails_for_survey_#{survey.id}")).to be true
end
Hi @mrvovanness,
The code is not covering that method from the resque-scheduler
API:
Resque.set_schedule(name, config)
This is not supported yet. A PR to do so would be welcome.
I am trying to test dynamic schedules. As is suggested I included in my Gemfile:
but I get error
can not load such file -- resque_scheduler
. I tried to include in environments/test.rb, but with same effect. I tried also to write simple test to be sure that gem is working:update action triggers scheduling(via after_save callback)
And I had output:
And web interface of Resque shows me that I created new schedule. I need some clues what is going on.