Sha256: 20f59cf57b7b11752c0b0dd7cb706e3668f541888189121079e057a3d6ba70f0

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper_models'

describe Gaku::ExamPortion do

  describe 'associations' do
    it { should belong_to :exam }
    it { should belong_to :grading_method }

    it { should have_many :exam_schedules }
    it { should have_many :exam_portion_scores }
    it { should have_many :attachments }
    it { should have_many :attendances }
  end

  describe 'validations' do
    let(:exam_portion) { create(:exam_portion) }

    it { should validate_presence_of :max_score }
    it { should validate_numericality_of :max_score }

    it 'should validate max_score is greater than 0' do
      exam_portion.max_score = -1
      exam_portion.should be_invalid
    end

    it 'should validate max_score is 0' do
      exam_portion.max_score = 0
      exam_portion.should be_valid
    end

    it 'should validate weight is greater than 0' do
      exam_portion.weight = -1
      exam_portion.should be_invalid
    end

    it 'should validate weight is 0' do
      exam_portion.weight = 0
      exam_portion.should be_valid
    end
  end

  context 'methods' do
    xit 'student_score'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gaku-0.2.4 core/spec/models/exam_portion_spec.rb
gaku-0.2.3 core/spec/models/exam_portion_spec.rb
gaku-0.2.2 core/spec/models/exam_portion_spec.rb
gaku-0.2.1 core/spec/models/exam_portion_spec.rb
gaku-0.2.0 core/spec/models/exam_portion_spec.rb