chore: Apply fixes for items in rubocop_todo [CW-1806] (#8864)

This PR addresses several items listed in our rubocop_todo by implementing the necessary corrections and enhancements. As a result, we are now able to remove the rubocop_todo file entirely, streamlining our codebase and ensuring adherence to our coding standards.

fixes: https://linear.app/chatwoot/issue/CW-1806/chore-rubocop-audit
This commit is contained in:
Sojan Jose
2024-02-07 13:36:04 +04:00
committed by GitHub
parent 3abb887445
commit 7776b74126
21 changed files with 67 additions and 398 deletions

View File

@@ -115,7 +115,7 @@ RSpec.describe Conversation do
let!(:conversation) do
create(:conversation, status: 'open', account: account, assignee: old_assignee)
end
let(:assignment_mailer) { double(deliver: true) }
let(:assignment_mailer) { instance_double(AssignmentMailer, deliver: true) }
let(:label) { create(:label, account: account) }
before do
@@ -142,7 +142,7 @@ RSpec.describe Conversation do
it 'runs after_update callbacks' do
conversation.update(
status: :resolved,
contact_last_seen_at: Time.now,
contact_last_seen_at: Time.zone.now,
assignee: new_assignee
)
status_change = conversation.status_change
@@ -193,7 +193,7 @@ RSpec.describe Conversation do
it 'creates conversation activities' do
conversation.update(
status: :resolved,
contact_last_seen_at: Time.now,
contact_last_seen_at: Time.zone.now,
assignee: new_assignee,
label_list: [label.title]
)
@@ -611,7 +611,7 @@ RSpec.describe Conversation do
account: conversation.account,
inbox: facebook_inbox,
conversation: conversation,
created_at: Time.now - 48.hours
created_at: 48.hours.ago
)
expect(conversation.can_reply?).to be true
@@ -626,7 +626,7 @@ RSpec.describe Conversation do
account: conversation.account,
inbox: facebook_inbox,
conversation: conversation,
created_at: Time.now - 48.hours
created_at: 48.hours.ago
)
expect(conversation.can_reply?).to be false
@@ -646,7 +646,7 @@ RSpec.describe Conversation do
account: conversation.account,
inbox: api_channel.inbox,
conversation: conversation,
created_at: Time.now - 13.hours
created_at: 13.hours.ago
)
expect(api_channel.additional_attributes['agent_reply_time_window']).to be_nil
@@ -662,7 +662,7 @@ RSpec.describe Conversation do
account: conversation.account,
inbox: api_channel_with_limit.inbox,
conversation: conversation,
created_at: Time.now - 13.hours
created_at: 13.hours.ago
)
expect(api_channel_with_limit.additional_attributes['agent_reply_time_window']).to eq '12'