Sha256: 97226705fcf396a438cbefd5d300a05214a3a8aacd8bf15460db90ea6781388e

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

require 'rails_helper'

describe SpudMenuItem, type: :model do

  it { should have_many(:spud_menu_items) }
  it { should belong_to(:spud_page) }
  it { should belong_to(:spud_menu) }
  it { should belong_to(:parent) }

  describe :validations do
    it 'should require a name' do
      p = FactoryGirl.build(:spud_menu_item, name: nil)
      expect(p).to_not be_valid
    end

    it 'should require a menu_id' do
      p = FactoryGirl.build(:spud_menu_item, spud_menu_id: nil)
      expect(p).to_not be_valid
    end

    it 'should require a parent_type' do
      p = FactoryGirl.build(:spud_menu_item, parent_type: nil)
      expect(p).to_not be_valid
    end

    it 'should require a parent_id' do
      p = FactoryGirl.build(:spud_menu_item, parent_id: nil)
      expect(p).to_not be_valid
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tb_cms-1.3.2 spec/models/spud_menu_item_spec.rb
tb_cms-1.3.1 spec/models/spud_menu_item_spec.rb
tb_cms-1.3.0 spec/models/spud_menu_item_spec.rb
tb_cms-1.3.beta1 spec/models/spud_menu_item_spec.rb