Sha256: 0465ffb441ee22e836812b5aa9fec14e989d375b73741e96b8b6447eca056fb6

Contents?: true

Size: 1.11 KB

Versions: 89

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

RSpec.describe CoalescingPanda::AssignmentGroup, :type => :model do
  let(:assignment_group) { FactoryGirl.create(:assignment_group) }

  context "associations" do
    it 'should belong_to a course' do
      expect(CoalescingPanda::AssignmentGroup.reflect_on_association(:course)).to_not be_nil
      expect(CoalescingPanda::AssignmentGroup.reflect_on_association(:course).macro).to eql(:belongs_to)
    end

    it 'should have many assignments' do
      expect(CoalescingPanda::AssignmentGroup.reflect_on_association(:assignments)).to_not be_nil
      expect(CoalescingPanda::AssignmentGroup.reflect_on_association(:assignments).macro).to eql(:has_many)
    end
  end

  context "validations" do
    it "should require a canvas id" do
      expect(FactoryGirl.build(:assignment_group, canvas_assignment_group_id: "")).to_not be_valid
    end

    it "should require a course" do
      expect(FactoryGirl.build(:assignment_group, coalescing_panda_course_id: "")).to_not be_valid
    end

    it "should be valid with valid data" do
      expect(FactoryGirl.build(:assignment_group)).to be_valid
    end
  end

end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
coalescing_panda-5.3.0 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.2 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.2.beta1 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.1 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.0 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.0.beta2 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.2.0.beta1 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.13 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.12 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.11 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.10 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.9 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.8 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.7 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.6 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.5 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.4 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.3.beta.2 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.3.beta.1 spec/models/coalescing_panda/assignment_group_spec.rb
coalescing_panda-5.1.3 spec/models/coalescing_panda/assignment_group_spec.rb