Sha256: d07b5b65c3c6672a5ca58ed3026a1605b8290a203c84ae9741b25bf963f3727b

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

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

3 entries across 3 versions & 1 rubygems

Version Path
gaku-0.0.3 core/spec/models/exam_portion_spec.rb
gaku-0.0.2 core/spec/models/exam_portion_spec.rb
gaku-0.0.1 core/spec/models/exam_portion_spec.rb