Sha256: 0802bffc97ebee6c05768f3b5482599e6d03a26d8ca6fb9affe1645fa7551723

Contents?: true

Size: 563 Bytes

Versions: 7

Compression:

Stored size: 563 Bytes

Contents

require 'spec_helper'

RSpec.describe Section, type: :model do
  let(:subject) { FactoryBot.create(:section) }

  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(:course)
        .with_primary_key(:canvas_id)
        .with_foreign_key(:canvas_course_id)
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
canvas_sync-0.22.9 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.8 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.6 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.5 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.4 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.3 spec/canvas_sync/models/section_spec.rb
canvas_sync-0.22.2 spec/canvas_sync/models/section_spec.rb