Sha256: 13232e71b916983d3224122463e6e8ade1d7c229d4c1e5620939f480fc132d91

Contents?: true

Size: 1.57 KB

Versions: 7

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) { FactoryBot.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

7 entries across 7 versions & 1 rubygems

Version Path
canvas_sync-0.22.9 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.8 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.6 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.5 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.4 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.3 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb
canvas_sync-0.22.2 spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb