Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)"
This reverts commit ef6ba8aabd.
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe V2::ReportBuilder do
|
||||
describe V2::ReportBuilder do
|
||||
include ActiveJob::TestHelper
|
||||
self.use_transactional_tests = false
|
||||
|
||||
def truncate_test_data
|
||||
connection = ActiveRecord::Base.connection
|
||||
connection.truncate_tables(*connection.tables)
|
||||
end
|
||||
|
||||
before { truncate_test_data }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let!(:label_1) { create(:label, title: 'Label_1', account: account) }
|
||||
let!(:label_2) { create(:label, title: 'Label_2', account: account) }
|
||||
let_it_be(:account) { create(:account) }
|
||||
let_it_be(:label_1) { create(:label, title: 'Label_1', account: account) }
|
||||
let_it_be(:label_2) { create(:label, title: 'Label_2', account: account) }
|
||||
|
||||
describe '#timeseries' do
|
||||
before do
|
||||
# Use before_all to share expensive setup across all tests in this describe block
|
||||
# This runs once instead of 21 times, dramatically speeding up the suite
|
||||
before_all do
|
||||
travel_to(Time.zone.today) do
|
||||
user = create(:user, account: account)
|
||||
inbox = create(:inbox, account: account)
|
||||
@@ -28,7 +21,7 @@ RSpec.describe V2::ReportBuilder do
|
||||
perform_enqueued_jobs do
|
||||
10.times do
|
||||
conversation = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: Time.zone.today)
|
||||
create_list(:message, 5, message_type: 'outgoing',
|
||||
account: account, inbox: inbox,
|
||||
@@ -44,7 +37,7 @@ RSpec.describe V2::ReportBuilder do
|
||||
|
||||
5.times do
|
||||
conversation = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: (Time.zone.today - 2.days))
|
||||
create_list(:message, 3, message_type: 'outgoing',
|
||||
account: account, inbox: inbox,
|
||||
|
||||
@@ -2,19 +2,11 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
include ActiveJob::TestHelper
|
||||
self.use_transactional_tests = false
|
||||
|
||||
def truncate_test_data
|
||||
connection = ActiveRecord::Base.connection
|
||||
connection.truncate_tables(*connection.tables)
|
||||
end
|
||||
|
||||
before { truncate_test_data }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let!(:label_1) { create(:label, title: 'label_1', account: account) }
|
||||
let!(:label_2) { create(:label, title: 'label_2', account: account) }
|
||||
let!(:label_3) { create(:label, title: 'label_3', account: account) }
|
||||
let_it_be(:account) { create(:account) }
|
||||
let_it_be(:label_1) { create(:label, title: 'label_1', account: account) }
|
||||
let_it_be(:label_2) { create(:label, title: 'label_2', account: account) }
|
||||
let_it_be(:label_3) { create(:label, title: 'label_3', account: account) }
|
||||
|
||||
let(:params) do
|
||||
{
|
||||
@@ -100,7 +92,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
# Create conversations with label_1
|
||||
3.times do
|
||||
conversation = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: Time.zone.today)
|
||||
create_list(:message, 2, message_type: 'outgoing',
|
||||
account: account, inbox: inbox,
|
||||
@@ -118,7 +110,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
# Create conversations with label_2
|
||||
2.times do
|
||||
conversation = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: Time.zone.today)
|
||||
create_list(:message, 1, message_type: 'outgoing',
|
||||
account: account, inbox: inbox,
|
||||
@@ -237,7 +229,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
perform_enqueued_jobs do
|
||||
# Conversation within range
|
||||
conversation_in_range = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: 2.days.ago)
|
||||
conversation_in_range.update_labels('label_1')
|
||||
conversation_in_range.label_list
|
||||
@@ -252,7 +244,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
|
||||
# Conversation outside range (too old)
|
||||
conversation_out_of_range = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: 1.week.ago)
|
||||
conversation_out_of_range.update_labels('label_1')
|
||||
conversation_out_of_range.label_list
|
||||
@@ -294,7 +286,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
|
||||
perform_enqueued_jobs do
|
||||
conversation = create(:conversation, account: account,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: Time.zone.today)
|
||||
conversation.update_labels('label_1')
|
||||
conversation.label_list
|
||||
@@ -331,8 +323,8 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
let(:account2_builder) do
|
||||
described_class.new(account: account2, params: {
|
||||
business_hours: false,
|
||||
since: test_date.in_time_zone.to_i.to_s,
|
||||
until: test_date.end_of_day.in_time_zone.to_i.to_s,
|
||||
since: test_date.to_time.to_i.to_s,
|
||||
until: test_date.end_of_day.to_time.to_i.to_s,
|
||||
timezone_offset: 0
|
||||
})
|
||||
end
|
||||
@@ -351,7 +343,7 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
|
||||
perform_enqueued_jobs do
|
||||
conversation = create(:conversation, account: account2,
|
||||
inbox: inbox,
|
||||
inbox: inbox, assignee: user,
|
||||
created_at: test_date)
|
||||
conversation.update_labels(unique_label_name)
|
||||
conversation.label_list
|
||||
@@ -366,7 +358,6 @@ RSpec.describe V2::Reports::LabelSummaryBuilder do
|
||||
# Second resolution
|
||||
conversation.resolved!
|
||||
end
|
||||
perform_enqueued_jobs
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user