When you need to test Rake tasks for a Rails app, its convenient to be able to write short, snappy specs like so: # File: spec/tasks/send_invoices_spec.rb require "rails_helper" describe "rake billing:send_invoices", type: :task do it "preloads the Rails environment" do expect(task.prerequisites).to include "environment" end it "runs gracefully with no subscribers" do expect { task.execute }.not_t