According to this tutorial http://carlosplusplus.github.io/blog/2014/02/01/testing-rake-tasks-with-rspec/
to test rake tasks with rspec, one has to set
Rake.application = rake
in a before block. However, I get the error
Failure/Error: Rake.application = rake
NameError:
uninitialized constant Rake
How can I fix this?
You need to require "rake"
before the offending code. The tutorial you are using is based on a blog post by Thoughtbot, which includes the appropriate require and can be used as an example.