require 'rails_helper'

RSpec.describe Menu, :type => :model do
  let(:menu) { FactoryGirl.create(:menu) }

  describe 'Fixtures' do
    it 'should have valid fixture factory' do
      expect(FactoryGirl.create(:menu)).to be_valid
    end
  end

  describe 'Associations' do
    it { is_expected.to have_and_belong_to_many :menu_items }
  end

  describe 'Database schema' do
    it { is_expected.to have_db_column :show_category }
    it { is_expected.to have_db_column :start_date }
    it { is_expected.to have_db_column :end_date }
    # Timestamps
    it { is_expected.to have_db_column :created_at }
    it { is_expected.to have_db_column :updated_at }

  end

  describe 'Validations' do
    it { is_expected.to validate_presence_of :start_date }
    it { is_expected.to validate_presence_of :end_date }
  end
end

require 'rails_helper'

RSpec.describe Menu, :type => :model do
  let(:menu) { FactoryGirl.create(:menu) }

  describe 'Fixtures' do
    it 'should have valid fixture factory' do
      expect(FactoryGirl.create(:menu)).to be_valid
    end
  end

  describe 'Associations' do
    it { is_expected.to have_and_belong_to_many :menu_items }
    it 'join table should have unique index' do
      ActiveRecord::Migration.index_exists?(:menu_items_menus, [:menu_id, :menu_item_id], unique: true)
    end
  end

  describe 'Database schema' do
    it { is_expected.to have_db_column :show_category }
    it { is_expected.to have_db_column :start_date }
    it { is_expected.to have_db_column :end_date }
    # Timestamps
    it { is_expected.to have_db_column :created_at }
    it { is_expected.to have_db_column :updated_at }

  end

  describe 'Validations' do
    it { is_expected.to validate_presence_of :start_date }
    it { is_expected.to validate_presence_of :end_date }
  end
end

Add test for join table index
Add test for join table index

Conflicts:
	spec/models/menu_spec.rb
