Speccing a rake task

Greetings,

I’m writing a custom rake task, and I’d like to write an assosciated
spec for it.

Does anyone have an example spec for a rake task?

I’ve seen some examples on the web that use these before blocks:
before(:each) do
@rake = Rake::Application.new
Rake.application = @rake
end

And use
@rake[“db:user_migration”].invoke

To invoke the task. But this doesn’t seem to work for me.

Thanks for the help!

dan