require 'rails_helper' module Mks module Rate RSpec.describe ServiceBundle, type: :model do it 'has a valid factory' do expect(create(:service_bundle)).to be_valid end it 'is invalid with no code' do expect(build(:service_bundle, code: nil)).not_to be_valid end it 'is invalid with no name' do expect(build(:service_bundle, name: nil)).not_to be_valid end it 'is invalid with no percent discount' do expect(build(:service_bundle, percent_discount: nil)).not_to be_valid end it 'is invalid with duplicate code' do sb = create(:service_bundle) expect(build(:service_bundle, code: sb.code)).not_to be_valid end end end end