Sha256: 3311e3d4a0c491b0b8f0aa8be76b2ec5afdcb1da023c37cc38f1b38b60a08f9b

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

require 'spec_helper'

describe Gaku::Program do

  describe 'associations' do
    it { should have_many :program_levels }
    it { should have_many(:levels).through(:program_levels) }

    it { should have_many :program_specialties }
    it { should have_many(:specialties).through(:program_specialties) }

    it { should have_many :program_syllabuses }
    it { should have_many(:syllabuses).through(:program_syllabuses) }

    it { should belong_to :school }
  end

  describe 'validations' do
    it { should validate_presence_of :name }
    it { should validate_presence_of :school }
  end

  describe 'nested_attributes' do
    it { should accept_nested_attributes_for :program_levels }
    it { should accept_nested_attributes_for :program_specialties }
    it { should accept_nested_attributes_for :program_syllabuses }
  end

  describe '#to_s' do
    let(:program) { build(:program) }
    specify { program.to_s.should eq program.name }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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