Calling the same rake task twice in RSpec

I am trying to test an rke task with rspec, and for this I need to call it twice, but it is called only once.

it 'first test' do Rake::Task['my_rake_task'].invoke # rake task was processed end it 'second test' do Rake::Task['my_rake_task'].invoke # rake task was NOT processed end 
+6
ruby rspec
source share
1 answer

if the rake call has already been called as soon as it is not started again, unless you call:

@rake[@task_name].reenable

or call it using

@rake[@task_name].execute

+14
source share

All Articles