Skip to content

Commit d6af0d8

Browse files
committed
Rake Task Testing: Emphasize spec/support/tasks.rb
1 parent c0f9aca commit d6af0d8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ When errors are raised, the Rails test environment may not behave as in producti
8585
# Testing Rake Tasks with RSpec
8686

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

9191

spec/tasks/subscription_tasks_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
require 'rails_helper'
22

3+
# IMPORTANT: Add spec/support/tasks.rb to your project to load rake tasks.
4+
35
RSpec.describe "Subscription tasks", :type => :task do
46

57
context "subscription:confirmation_overdue:delete" do
@@ -34,7 +36,7 @@
3436

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

0 commit comments

Comments
 (0)