require 'rails_helper'

RSpec.describe AdminPermission, type: :model do
  subject { build(:admin_permission) }

  it { is_expected.to be_valid }

  describe 'associations' do
    it { should belong_to(:user) }
  end

  describe 'validations' do
    it do
      should define_enum_for(:accounting)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
    it do
      should define_enum_for(:admissions)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
    it do
      should define_enum_for(:communications)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
    it do
      should define_enum_for(:discipline)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
    it do
      should define_enum_for(:library)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
    it do
      should define_enum_for(:service)
        .with_prefix(true)
        .with_values([:none, :read, :write, :manage])
    end
  end
end
