canvas_sync 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 792fd9d830f8f82a41f33582487638b3bbb2dbf5
4
- data.tar.gz: dda6faccb4e9c3377a74d182ac9538ae7bc5ed27
3
+ metadata.gz: d67da42a99163681e0b38c654370ebe31e8fcb76
4
+ data.tar.gz: 7ec74a8b1bbbac7878db5b4c81a1d0944acb7c74
5
5
  SHA512:
6
- metadata.gz: 5d48237b5c4de288a01cd4c4645c097b35175255c492de9e9729efde69d9adad1884e12f5a9c2b0a47c059c54885f940dff451299130562f8215722f0b682ee5
7
- data.tar.gz: 0eaafea6e753ed585495fb0f2b049e8c0f4c9c67824c3e9ee84a61c7b6e119d1fa36f990f32f3fe94b78629fdf714be5ea960a3e491ec7f190bac1b8b8d5a7a4
6
+ metadata.gz: e78e38fcc9e151c21d0b562a12cdae647b474aaf13eaa980be2dcbcafa4e45b2a37943d0d2ed4b893fe839927cc61a167d60dbdb3b4af0ed6f49be22f7abdea9
7
+ data.tar.gz: 2e1bb5e9523491efd415f947340fc9bbf37b49f07c5d2afcb27f9ec5a9da639f47dff83ef372bdfd546fb842f4fca48b0b7f3928ba776dd51b15ad4c1f15f60e
@@ -7,26 +7,24 @@ module CanvasSync
7
7
  # will be started for each term in that scope. :models should be an array of
8
8
  # models to sync.
9
9
  def perform(job_chain, options)
10
- @job_chain = job_chain
11
-
12
10
  if options[:term_scope]
13
11
  Term.send(options[:term_scope]).find_each do |term|
14
- # Deep copy the options so each report gets the correct term id passed into
12
+ # Deep copy the job_chain so each report gets the correct term id passed into
15
13
  # its options with no side effects
16
- duped_options = Marshal.load(Marshal.dump(options))
17
- duped_options[:canvas_term_id] = term.canvas_term_id
18
- start_report(report_params(options, term.canvas_term_id), duped_options)
14
+ duped_job_chain = Marshal.load(Marshal.dump(job_chain))
15
+ duped_job_chain[:options][:canvas_term_id] = term.canvas_term_id
16
+ start_report(report_params(options, term.canvas_term_id), duped_job_chain, options)
19
17
  end
20
18
  else
21
- start_report(report_params(options), options)
19
+ start_report(report_params(options), job_chain, options)
22
20
  end
23
21
  end
24
22
 
25
23
  private
26
24
 
27
- def start_report(report_params, options)
25
+ def start_report(report_params, job_chain, options)
28
26
  CanvasSync::Jobs::ReportStarter.perform_later(
29
- @job_chain,
27
+ job_chain,
30
28
  'proservices_provisioning_csv',
31
29
  report_params,
32
30
  CanvasSync::Processors::ProvisioningReportProcessor.to_s,
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -2,15 +2,20 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
4
4
  describe '#perform' do
5
+ let(:job_chain) { {jobs: [], options: {}} }
6
+
5
7
  context 'a term scope is specified' do
6
8
  let!(:active_term_1) { FactoryGirl.create(:term) }
7
9
  let!(:active_term_2) { FactoryGirl.create(:term) }
8
10
  let!(:inactive_term_1) { FactoryGirl.create(:term, workflow_state: 'inactive') }
9
11
 
10
12
  it 'enqueues a ReportStarter for a provisioning report for the specified models for each term' do
13
+ expected_job_chain = Marshal.load(Marshal.dump(job_chain))
14
+ expected_job_chain[:options][:canvas_term_id] = active_term_1.canvas_term_id
15
+
11
16
  expect(CanvasSync::Jobs::ReportStarter).to receive(:perform_later)
12
17
  .with(
13
- [],
18
+ expected_job_chain,
14
19
  'proservices_provisioning_csv',
15
20
  {
16
21
  "parameters[include_deleted]" => true,
@@ -19,12 +24,15 @@ RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
19
24
  "parameters[enrollment_term_id]" => active_term_1.canvas_term_id
20
25
  },
21
26
  CanvasSync::Processors::ProvisioningReportProcessor.to_s,
22
- { models: ['users', 'courses'], term_scope: 'active', canvas_term_id: active_term_1.canvas_term_id }
27
+ { models: ['users', 'courses'], term_scope: 'active' }
23
28
  )
24
29
 
30
+ expected_job_chain_2 = Marshal.load(Marshal.dump(job_chain))
31
+ expected_job_chain_2[:options][:canvas_term_id] = active_term_2.canvas_term_id
32
+
25
33
  expect(CanvasSync::Jobs::ReportStarter).to receive(:perform_later)
26
34
  .with(
27
- [],
35
+ expected_job_chain_2,
28
36
  'proservices_provisioning_csv',
29
37
  {
30
38
  "parameters[include_deleted]" => true,
@@ -33,11 +41,11 @@ RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
33
41
  "parameters[enrollment_term_id]" => active_term_2.canvas_term_id
34
42
  },
35
43
  CanvasSync::Processors::ProvisioningReportProcessor.to_s,
36
- { models: ['users', 'courses'], term_scope: 'active', canvas_term_id: active_term_2.canvas_term_id }
44
+ { models: ['users', 'courses'], term_scope: 'active' }
37
45
  )
38
46
 
39
47
  CanvasSync::Jobs::SyncProvisioningReportJob.perform_now(
40
- [],
48
+ job_chain,
41
49
  { models: ['users', 'courses'], term_scope: 'active' }
42
50
  )
43
51
  end
@@ -47,7 +55,7 @@ RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
47
55
  it 'enqueues a single ReportStarter for a provisioning report across all terms for the specified models' do
48
56
  expect(CanvasSync::Jobs::ReportStarter).to receive(:perform_later)
49
57
  .with(
50
- [],
58
+ job_chain,
51
59
  'proservices_provisioning_csv',
52
60
  {
53
61
  "parameters[include_deleted]" => true,
@@ -59,7 +67,7 @@ RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
59
67
  )
60
68
 
61
69
  CanvasSync::Jobs::SyncProvisioningReportJob.perform_now(
62
- [],
70
+ job_chain,
63
71
  { models: ['users', 'courses'] }
64
72
  )
65
73
  end
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-14 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler