Sha256: 67b7b4c34f56319145d010020c04db31592bab584c9364e4c836ac91d854e4ba

Contents?: true

Size: 1.01 KB

Versions: 127

Compression:

Stored size: 1.01 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_id) }
    it { should validate_uniqueness_of(:canvas_id) }
  end

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

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

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

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

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

    it do
      should have_many(:submissions)
    end

    it do
      should have_many(:groups)
    end
  end
end

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
canvas_sync-0.17.3.beta1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.1 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta15 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta14 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta13 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta12 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta11 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta10 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta9 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta8 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta7 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta6 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta5 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta4 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.16.5 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta3 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta2 spec/canvas_sync/models/course_spec.rb
canvas_sync-0.17.0.beta1 spec/canvas_sync/models/course_spec.rb