Sha256: b4bb7031c46d9a1b679576494ad8b8e5ff934a12b696f89fd01e5bda2f58ae69
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
require 'rails_helper' module Mks module Rate RSpec.describe ChargeableService, type: :model do it 'has a valid factory' do expect(create(:chargeable_service)).to be_valid end it 'is invalid without code' do expect(build(:chargeable_service, code: nil)).not_to be_valid end it 'is invalid without name' do expect(build(:chargeable_service, name: nil)).not_to be_valid end it 'is invalid with without base unit' do expect(build(:chargeable_service, base_unit: nil)).not_to be_valid end it 'is invalid without service delivery unit' do expect(build(:chargeable_service, service_delivery_unit_id: nil)).not_to be_valid end it 'can not have chargeable services with same code' do cs = create(:chargeable_service) expect(build(:chargeable_service, code: cs.code, service_delivery_unit_id: cs.service_delivery_unit_id)).not_to be_valid end it 'can create default service bundle upon save' do cs = create(:chargeable_service) expect(ServiceBundle.count).to eq 1 sb = ServiceBundle.first expect(sb.name).to eq cs.name expect(sb.code).to eq cs.code expect(sb.chargeable_services.count).to eq 1 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems