chore: Enable the new Rubocop rules (#7122)

fixes: https://linear.app/chatwoot/issue/CW-1574/renable-the-disabled-rubocop-rules
This commit is contained in:
Sojan Jose
2023-05-19 14:37:10 +05:30
committed by GitHub
parent b988a01df3
commit 7ab7bac6bf
215 changed files with 609 additions and 608 deletions

View File

@@ -5,8 +5,8 @@ FactoryBot.define do
before(:create) do |channel_telegram|
# we are skipping some of the validation methods
channel_telegram.define_singleton_method(:ensure_valid_bot_token) { return }
channel_telegram.define_singleton_method(:setup_telegram_webhook) { return }
channel_telegram.define_singleton_method(:ensure_valid_bot_token) { nil }
channel_telegram.define_singleton_method(:setup_telegram_webhook) { nil }
end
after(:create) do |channel_telegram|

View File

@@ -41,8 +41,8 @@ FactoryBot.define do
before(:create) do |channel_whatsapp, options|
# since factory already has the required message templates, we just need to bypass it getting updated
channel_whatsapp.define_singleton_method(:sync_templates) { return } unless options.sync_templates
channel_whatsapp.define_singleton_method(:validate_provider_config) { return } unless options.validate_provider_config
channel_whatsapp.define_singleton_method(:sync_templates) { nil } unless options.sync_templates
channel_whatsapp.define_singleton_method(:validate_provider_config) { nil } unless options.validate_provider_config
if channel_whatsapp.provider == 'whatsapp_cloud'
channel_whatsapp.provider_config = channel_whatsapp.provider_config.merge({ 'api_key' => 'test_key', 'phone_number_id' => '123456789',
'business_account_id' => '123456789' })

View File

@@ -16,14 +16,14 @@ FactoryBot.define do
channel: create(:channel_instagram_fb_page, account: message.account, instagram_id: 'instagram-123'))
end
attachment = message.attachments.new(account_id: message.account_id, file_type: :image, external_url: 'https://www.example.com/test.jpeg')
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
attachment.file.attach(io: Rails.root.join('spec/assets/avatar.png').open, filename: 'avatar.png', content_type: 'image/png')
end
end
trait :with_attachment do
after(:build) do |message|
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
attachment.file.attach(io: Rails.root.join('spec/assets/avatar.png').open, filename: 'avatar.png', content_type: 'image/png')
end
end