Sha256: a75d26bfbc1d1ea966f379e42fab26ca3ab24316f2a0cae136c4483fc49a0b6c

Contents?: true

Size: 1.89 KB

Versions: 10

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

RSpec.describe CanvasSync::Jobs::SyncSimpleTableJob do
  describe '#perform' do
    let(:job_chain) { {jobs: [], global_options: {}} }

    context 'Simple report' do
      let!(:active_term_1) { FactoryGirl.create(:term) }
      let!(:inactive_term_1) { FactoryGirl.create(:term, workflow_state: 'inactive') }

      it 'enqueues a ReportStarter for a provisioning report for the specified model for a term' do
        expected_job_chain = Marshal.load(Marshal.dump(job_chain))
        expected_job_chain[:global_options][:canvas_term_id] = active_term_1.canvas_term_id

        expect(CanvasSync::Jobs::ReportStarter).to receive(:perform_later)
          .with(
            expected_job_chain,
            'proservices_provisioning_csv',
            {
              "parameters[include_deleted]" => true,
              "parameters[courses]" => true,
              "parameters[enrollment_term_id]" => active_term_1.canvas_term_id
            },
            CanvasSync::Processors::NormalProcessor.to_s,
            {
              report_name: 'proservices_provisioning_csv',
              model: 'courses',
              mapping: 'courses',
              klass: 'Course',
              term_scope: 'active',
              params: {
                "parameters[include_deleted]" => true,
                "parameters[courses]" => true,
                "parameters[enrollment_term_id]" => active_term_1.canvas_term_id
              }
            }
          )

        CanvasSync::Jobs::SyncSimpleTableJob.perform_now(
          job_chain,
          {
            report_name: 'proservices_provisioning_csv',
            model: 'courses',
            mapping: 'courses',
            klass: 'Course',
            term_scope: 'active',
            params: {
              "parameters[include_deleted]" => true,
              "parameters[courses]" => true
            }
          }
        )

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
canvas_sync-0.9.4 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.9.3 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.9.2 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.9.1 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.9.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.8.4 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.8.3 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.8.2 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.8.1 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.8.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb