-
Notifications
You must be signed in to change notification settings - Fork 724
Expand file tree
/
Copy pathbatch_rake_spec.rb
More file actions
32 lines (27 loc) · 932 Bytes
/
batch_rake_spec.rb
File metadata and controls
32 lines (27 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true
require 'rails_helper'
require "#{Rails.root}/lib/data_cycle/constant_update"
require "#{Rails.root}/lib/data_cycle/schedule_course_updates"
require "#{Rails.root}/lib/data_cycle/daily_update"
require "#{Rails.root}/lib/data_cycle/survey_update"
require "#{Rails.root}/lib/tickets/ticket_notification_emails"
# https://robots.thoughtbot.com/test-rake-tasks-like-a-boss
describe 'batch:pause' do
include_context 'rake'
describe 'pause' do
it 'creates a pause file' do
pause_file = 'tmp/batch_pause.pid'
rake['batch:pause'].invoke
expect(File.exist?(pause_file)).to eq(true)
File.delete pause_file
end
end
describe 'resume' do
it 'deletes a pause file' do
pause_file = 'tmp/batch_pause.pid'
File.open(pause_file, 'w') { |f| f.puts 'ohai' }
rake['batch:resume'].invoke
expect(File.exist?(pause_file)).to eq(false)
end
end
end