Skip to content

Commit

Permalink
Rake Task Testing: Emphasize spec/support/tasks.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotsykes committed Dec 10, 2015
1 parent c0f9aca commit d6af0d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -85,7 +85,7 @@ When errors are raised, the Rails test environment may not behave as in producti
# Testing Rake Tasks with RSpec

RSpec testing Rake task configuration and example:
- [spec/support/tasks.rb](spec/support/tasks.rb)
- [spec/support/tasks.rb](spec/support/tasks.rb) essential to load Rake tasks before specs run
- [spec/tasks/subscription_tasks_spec.rb](spec/tasks/subscription_tasks_spec.rb)


Expand Down
4 changes: 3 additions & 1 deletion spec/tasks/subscription_tasks_spec.rb
@@ -1,5 +1,7 @@
require 'rails_helper'

# IMPORTANT: Add spec/support/tasks.rb to your project to load rake tasks.

RSpec.describe "Subscription tasks", :type => :task do

context "subscription:confirmation_overdue:delete" do
Expand Down Expand Up @@ -34,7 +36,7 @@

def invoke_task
task = Rake::Task["subscription:confirmation_overdue:delete"]
# Ensure task is re-enabled, as rake tasks by default are disabled
# Ensure task is re-enabled, as rake tasks by default are disabled
# after running once within a process http://pivotallabs.com/how-i-test-rake-tasks/
task.reenable
task.invoke
Expand Down

0 comments on commit d6af0d8

Please sign in to comment.