Sha256: ed2dc4a4f8093ed0a464cfe846dd7e61a93e8156b8c99d7959077829812e5dbf

Contents?: true

Size: 1013 Bytes

Versions: 7

Compression:

Stored size: 1013 Bytes

Contents

require 'spec_helper_models'

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_uniqueness_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

7 entries across 7 versions & 1 rubygems

Version Path
gaku-0.2.4 core/spec/models/program_spec.rb
gaku-0.2.3 core/spec/models/program_spec.rb
gaku-0.2.2 core/spec/models/program_spec.rb
gaku-0.2.1 core/spec/models/program_spec.rb
gaku-0.2.0 core/spec/models/program_spec.rb
gaku-0.1.1 core/spec/models/program_spec.rb
gaku-0.1.0 core/spec/models/program_spec.rb