Files
chatwoot/spec/enterprise/models/sla_policy_spec.rb
T
Sojan Jose 965c316b77 chore: revert more RuboCop cosmetic changes to reduce PR size
Reverted Layout/EmptyLineAfterGuardClause fixes in:
- 29+ controller files
- Multiple service, worker, and mailbox files
- Several spec files
- Enterprise module files

This keeps the PR focused on functional Rails 7.2 upgrade changes only.
2025-08-14 13:33:49 +02:00

29 lines
968 B
Ruby

require 'rails_helper'
RSpec.describe SlaPolicy, type: :model do
include ActiveJob::TestHelper
let(:account) { create(:account) }
let(:admin) { create(:user, account: account, role: :administrator) }
describe 'validations' do
it { is_expected.to validate_presence_of(:name) }
end
describe 'associations' do
it { is_expected.to belong_to(:account) }
it { is_expected.to have_many(:conversations).dependent(:nullify) }
end
describe 'validates_factory' do
it 'creates valid sla policy object' do
sla_policy = create(:sla_policy)
expect(sla_policy.name).to eq 'sla_1'
expect(sla_policy.first_response_time_threshold).to eq 2000
expect(sla_policy.description).to eq 'SLA policy for enterprise customers'
expect(sla_policy.next_response_time_threshold).to eq 1000
expect(sla_policy.resolution_time_threshold).to eq 3000
expect(sla_policy.only_during_business_hours).to be false
end
end
end