Sha256: 5b101b2df68db3c13e5196a4d0de4304c3e2990ae6c169ded65f32d7354d5bf6

Contents?: true

Size: 726 Bytes

Versions: 23

Compression:

Stored size: 726 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
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
canvas_sync-0.3.11 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.10 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.9 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.8 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.7 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.6 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.5 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.3.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.2.4 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.2.3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.2.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.2.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.2.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.1.8 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.1.7 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.1.5 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.1.4 spec/canvas_sync/models/course_spec.rb