require 'rails_helper'

RSpec.describe Accounting::Subcategory, type: :model do
  subject { build(:accounting_subcategory) }

  it { is_expected.to be_valid }

  describe 'association' do
    it { should belong_to(:category) }
    it { should have_many(:transaction_details).dependent(:destroy) }
    it { should have_many(:student_matrices).dependent(:destroy) }
  end

  describe 'validations' do
    it { should validate_presence_of(:name) }
    it { should validate_presence_of(:viewable) }
    it { should validate_length_of(:name).is_at_most(255) }
  end
end
