Skip to content

Instantly share code, notes, and snippets.

@timdiggins
Created March 20, 2015 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timdiggins/963b0584a6ce56f63d83 to your computer and use it in GitHub Desktop.
Save timdiggins/963b0584a6ce56f63d83 to your computer and use it in GitHub Desktop.
testing rake in rspec (etc)
# ./spec/support/rake_testing_support.rb
def invoke_rake_task_in_test(task_name)
require 'rake'
Rails.application.load_tasks if Rake.application.tasks.count < 10
Rake::Task[task_name].reenable
Rake::Task[task_name].invoke
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment