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