Sha256: c8963b21ac9852b6660625c33c8cee3d8a3e9720434b316c8b121b509dc728a0

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

RSpec.describe CanvasSync::Processors::ProvisioningReportProcessor do
  let(:subject) { CanvasSync::Processors::ProvisioningReportProcessor }

  describe '#process' do
    it 'process users' do
      expect {
        subject.process('spec/support/fixtures/reports/users.csv', { models: ['users'] })
      }.to change { User.count }.by(2)
    end

    it 'processes courses' do
      expect {
        subject.process('spec/support/fixtures/reports/courses.csv', { models: ['courses'] })
      }.to change { Course.count }.by(2)
    end

    it 'processes enrollments' do
      expect {
        subject.process('spec/support/fixtures/reports/enrollments.csv', { models: ['enrollments'] })
      }.to change { Enrollment.count }.by(2)
    end

    it 'processes sections' do
      expect {
        subject.process('spec/support/fixtures/reports/sections.csv', { models: ['sections'] })
      }.to change { Section.count }.by(2)
    end

    context 'options[:models] is multiple models' do
      it 'extracts the ZIP and processes each model' do
        user_count = User.count
        course_count = Course.count
        subject.process('spec/support/fixtures/reports/provisioning_csv', { models: ['courses', 'users'] })
        expect(User.count).to eq(user_count + 2)
        expect(Course.count).to eq(course_count + 2)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
canvas_sync-0.1.8 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.7 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.5 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.4 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.3 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.2 spec/canvas_sync/processors/provisioning_report_processor_spec.rb
canvas_sync-0.1.1 spec/canvas_sync/processors/provisioning_report_processor_spec.rb