Sha256: e214b4710c34f229353c1078c230c15ce7e624a8a4f16f977c284dffd2399e44

Contents?: true

Size: 811 Bytes

Versions: 3

Compression:

Stored size: 811 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 = FactoryBot.build(:spud_menu_item, name: nil)
      expect(p).to_not be_valid
    end

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tb_cms-1.3.6 spec/models/spud_menu_item_spec.rb
tb_cms-1.3.5 spec/models/spud_menu_item_spec.rb
tb_cms-1.3.3 spec/models/spud_menu_item_spec.rb