diff --git a/spec/builders/v2/reports/inbox_label_matrix_builder_spec.rb b/spec/builders/v2/reports/inbox_label_matrix_builder_spec.rb index 524f89e4a..eb3e09f6a 100644 --- a/spec/builders/v2/reports/inbox_label_matrix_builder_spec.rb +++ b/spec/builders/v2/reports/inbox_label_matrix_builder_spec.rb @@ -20,13 +20,13 @@ RSpec.describe V2::Reports::InboxLabelMatrixBuilder do context 'when there are conversations with labels across inboxes' do before do c1 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.days.ago) - c1.update(label_list: [label_one.title]) + c1.update!(label_list: [label_one.title]) c2 = create(:conversation, account: account, inbox: inbox_one, created_at: 3.days.ago) - c2.update(label_list: [label_one.title, label_two.title]) + c2.update!(label_list: [label_one.title, label_two.title]) c3 = create(:conversation, account: account, inbox: inbox_two, created_at: 1.day.ago) - c3.update(label_list: [label_two.title]) + c3.update!(label_list: [label_two.title]) end it 'returns inboxes ordered by name' do @@ -61,10 +61,10 @@ RSpec.describe V2::Reports::InboxLabelMatrixBuilder do before do c1 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.days.ago) - c1.update(label_list: [label_one.title]) + c1.update!(label_list: [label_one.title]) c2 = create(:conversation, account: account, inbox: inbox_two, created_at: 1.day.ago) - c2.update(label_list: [label_one.title]) + c2.update!(label_list: [label_one.title]) end it 'only includes the specified inboxes and their counts' do @@ -84,7 +84,7 @@ RSpec.describe V2::Reports::InboxLabelMatrixBuilder do before do c1 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.days.ago) - c1.update(label_list: [label_one.title, label_two.title]) + c1.update!(label_list: [label_one.title, label_two.title]) end it 'only includes the specified labels and their counts' do @@ -96,10 +96,10 @@ RSpec.describe V2::Reports::InboxLabelMatrixBuilder do context 'when conversations are outside the date range' do before do c1 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.days.ago) - c1.update(label_list: [label_one.title]) + c1.update!(label_list: [label_one.title]) c2 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.weeks.ago) - c2.update(label_list: [label_one.title]) + c2.update!(label_list: [label_one.title]) end it 'only counts conversations within the date range' do @@ -124,7 +124,7 @@ RSpec.describe V2::Reports::InboxLabelMatrixBuilder do before do c1 = create(:conversation, account: other_account, inbox: other_inbox, created_at: 2.days.ago) other_label = create(:label, account: other_account, title: 'bug') - c1.update(label_list: [other_label.title]) + c1.update!(label_list: [other_label.title]) end it 'does not include conversations from other accounts' do diff --git a/spec/controllers/api/v2/accounts/reports_controller_spec.rb b/spec/controllers/api/v2/accounts/reports_controller_spec.rb index f7bf86978..df8a8d5a0 100644 --- a/spec/controllers/api/v2/accounts/reports_controller_spec.rb +++ b/spec/controllers/api/v2/accounts/reports_controller_spec.rb @@ -219,7 +219,7 @@ RSpec.describe Api::V2::Accounts::ReportsController, type: :request do context 'when authenticated as admin' do before do c1 = create(:conversation, account: account, inbox: inbox_one, created_at: 2.days.ago) - c1.update(label_list: [label_one.title]) + c1.update!(label_list: [label_one.title]) end it 'returns the inbox label matrix' do diff --git a/spec/lib/captain/base_task_service_spec.rb b/spec/lib/captain/base_task_service_spec.rb index b3c330252..85d93cc04 100644 --- a/spec/lib/captain/base_task_service_spec.rb +++ b/spec/lib/captain/base_task_service_spec.rb @@ -143,7 +143,7 @@ RSpec.describe Captain::BaseTaskService do context 'when API key is not configured' do before do - InstallationConfig.find_by(name: 'CAPTAIN_OPEN_AI_API_KEY')&.destroy + InstallationConfig.find_by(name: 'CAPTAIN_OPEN_AI_API_KEY')&.destroy! # Clear memoized api_key service.instance_variable_set(:@api_key, nil) end diff --git a/spec/models/concerns/account_email_rate_limitable_spec.rb b/spec/models/concerns/account_email_rate_limitable_spec.rb index 919c5f621..4ef863a78 100644 --- a/spec/models/concerns/account_email_rate_limitable_spec.rb +++ b/spec/models/concerns/account_email_rate_limitable_spec.rb @@ -10,12 +10,12 @@ RSpec.describe AccountEmailRateLimitable do end it 'returns global config when no account override' do - InstallationConfig.where(name: 'ACCOUNT_EMAILS_LIMIT').first_or_create(value: 200) + InstallationConfig.where(name: 'ACCOUNT_EMAILS_LIMIT').first_or_create!(value: 200) expect(account.email_rate_limit).to eq(200) end it 'returns account override over global config' do - InstallationConfig.where(name: 'ACCOUNT_EMAILS_LIMIT').first_or_create(value: 200) + InstallationConfig.where(name: 'ACCOUNT_EMAILS_LIMIT').first_or_create!(value: 200) account.update!(limits: { 'emails' => 50 }) expect(account.email_rate_limit).to eq(50) end