Sha256: 1451b2dc969d64af3701855b5888dde102cf99f62e9a04ce25dba6f3f116a623

Contents?: true

Size: 1.98 KB

Versions: 13

Compression:

Stored size: 1.98 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_id
        expected_job_chain[:global_options] = hash_including(expected_job_chain[:global_options])

        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_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_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

13 entries across 13 versions & 1 rubygems

Version Path
canvas_sync-0.11.1 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.16.4 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.16.3 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.16.2 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.16.1 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.15.1 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.15.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.14.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.13.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.12.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.11.0 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.10.6 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb
canvas_sync-0.10.5 spec/canvas_sync/jobs/sync_simple_table_job_spec.rb