Sha256: 4b3bbb58c77f4757d029699f02b2a6e4e477f91a75139c416e4a47be92cf1b4f

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

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(: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

1 entries across 1 versions & 1 rubygems

Version Path
canvas_sync-0.3.14 spec/canvas_sync/models/course_spec.rb