Sha256: f6b63232df492e40ed77534e23a73f9f188b317a239363fc84233267b5458f9e

Contents?: true

Size: 1.05 KB

Versions: 34

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

RSpec.describe Course, type: :model do
  let(:subject) { FactoryGirl.create(:course) }

  describe 'validations' do
    it { should validate_presence_of(:canvas_course_id) }
    it { should validate_uniqueness_of(:canvas_course_id) }
  end

  describe 'associations' do
    it do
      should belong_to(:term)
        .with_primary_key(:canvas_term_id)
        .with_foreign_key(:canvas_term_id)
    end

    it do
      should have_many(:enrollments)
        .with_primary_key(:canvas_course_id)
        .with_foreign_key(:canvas_course_id)
    end

    it do
      should have_many(:sections)
        .with_primary_key(:canvas_course_id)
        .with_foreign_key(:canvas_course_id)
    end

    it do
      should have_many(:assignment_groups)
        .with_primary_key(:canvas_course_id)
        .with_foreign_key(:canvas_course_id)
    end

    it do
      should have_many(:assignments)
        .with_primary_key(:canvas_course_id)
    end

    it do
      should have_many(:submissions)
        .with_primary_key(:canvas_course_id)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
canvas_sync-0.9.4 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.9.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.9.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.9.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.9.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.8.4 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.8.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.8.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.8.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.8.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.7.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.7.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.7.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.7.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.6.4 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.6.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.6.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.6.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.6.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.5.4 spec/canvas_sync/models/course_spec.rb