Sha256: d24d94e7c415e5e96d3d580b32c2c5666db8d43fae258f84849955d4240a0dab

Contents?: true

Size: 1.57 KB

Versions: 108

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'

RSpec.describe CanvasSync::Jobs::SyncProvisioningReportJob do
  describe '#perform' do
    context 'a term scope is specified' do
      let!(:term) { FactoryGirl.create(:term) }

      it 'enqueues a ReportStarter for a provisioning report for the specified models for each term' do
          expect_any_instance_of(CanvasSync::Jobs::ReportStarter).to receive(:start_report)
          .with(
            'self',
            'proservices_provisioning_csv',
            {
              parameters: {
                include_deleted: true,
                'users' => true,
                'courses' => true,
                enrollment_term_id: term.canvas_id,
              }
            },
          )

        set_batch_context(canvas_term_id: term.canvas_id)
        CanvasSync::Jobs::SyncProvisioningReportJob.perform_now(
          { models: ['users', 'courses'], term_scope: 'active' }
        )
      end
    end

    context 'a term scope is not specified' do
      it 'enqueues a single ReportStarter for a provisioning report across all terms for the specified models' do
        expect_any_instance_of(CanvasSync::Jobs::ReportStarter).to receive(:start_report)
          .with(
            'self',
            'proservices_provisioning_csv',
            {
              parameters: {
                include_deleted: true,
                'users' => true,
                'courses' => true,
              }
            },
          )

        CanvasSync::Jobs::SyncProvisioningReportJob.perform_now(
          { models: ['users', 'courses'] }
        )
      end
    end
  end
end

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
canvas_sync-0.22.1 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta8 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta7 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta6 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta5 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta4 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta3 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta2 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.0.beta1 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.1 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.1.beta1 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0.beta5 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0.beta4 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0.beta3 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0.beta2 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.21.0.beta1 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.20.5 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.20.4 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb