Browse Source

Maintenance: Use :aggregate_failures in specs when needed.

Martin Gruner 2 years ago
parent
commit
a95578466f

+ 2 - 2
spec/graphql/gql/record_loader_spec.rb

@@ -124,7 +124,7 @@ RSpec.describe Gql::RecordLoader, type: :graphql do
       QUERY
     end
 
-    it 'performs only the expected amount of DB queries', authenticated_as: :agent do # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
+    it 'performs only the expected amount of DB queries', :aggregate_failures, authenticated_as: :agent do # rubocop:disable RSpec/ExampleLength
       # Create variables here and not via let(), otherwise the objects would be instantiated later in the traced block.
       variables = { overviewId: overview_id }
       total_queries = {}
@@ -242,7 +242,7 @@ RSpec.describe Gql::RecordLoader, type: :graphql do
       QUERY
     end
 
-    it 'performs only the expected amount of DB queries', authenticated_as: :agent do # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
+    it 'performs only the expected amount of DB queries', :aggregate_failures, authenticated_as: :agent do # rubocop:disable RSpec/ExampleLength
       variables = { ticketId: ticket_id, withArticles: true }
       total_queries = {}
       uncached_queries = {}

+ 3 - 3
spec/lib/background_services/service/process_delayed_jobs_spec.rb

@@ -30,7 +30,7 @@ RSpec.describe BackgroundServices::Service::ProcessDelayedJobs, ensure_threads_e
         end.to change(Delayed::Job, :count).by(-1)
       end
 
-      it 'runs loop multiple times' do # rubocop:disable RSpec/MultipleExpectations
+      it 'runs loop multiple times', :aggregate_failures do
         allow(instance).to receive(:process_results)
 
         ensure_block_keeps_running { instance.run }
@@ -42,7 +42,7 @@ RSpec.describe BackgroundServices::Service::ProcessDelayedJobs, ensure_threads_e
   end
 
   describe '#process_results' do
-    it 'sleeps & loops when no jobs processed' do # rubocop:disable RSpec/MultipleExpectations
+    it 'sleeps & loops when no jobs processed', :aggregate_failures do
       allow(Rails.logger).to receive(:debug)
       instance.send(:process_results, [0, 0], 1)
 
@@ -51,7 +51,7 @@ RSpec.describe BackgroundServices::Service::ProcessDelayedJobs, ensure_threads_e
       end
     end
 
-    it 'loops immediatelly when there was anything to process' do # rubocop:disable RSpec/MultipleExpectations
+    it 'loops immediatelly when there was anything to process', :aggregate_failures do
       allow(Rails.logger).to receive(:debug)
       instance.send(:process_results, [1, 0], 1)
 

+ 1 - 1
spec/lib/background_services_spec.rb

@@ -67,7 +67,7 @@ RSpec.describe BackgroundServices do
       context 'when disabled' do
         let(:is_disabled) { true }
 
-        it 'stops early if disabled' do # rubocop:disable RSpec/MultipleExpectations
+        it 'stops early if disabled', :aggregate_failures do
           allow(Rails.logger).to receive(:debug)
           instance.send(:run_service, config)
 

+ 1 - 1
spec/lib/sequencer/sequence/import/freshdesk/group_spec.rb

@@ -30,7 +30,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Group, sequencer: :sequ
       }
     end
 
-    it 'adds groups' do # rubocop:disable RSpec/MultipleExpectations
+    it 'adds groups', :aggregate_failures do
       expect { process(process_payload) }.to change(Group, :count).by(1)
       expect(Group.last).to have_attributes(
         name:   'QA',

+ 2 - 2
spec/lib/sequencer/sequence/import/zendesk/group_spec.rb

@@ -36,7 +36,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Zendesk::Group, sequencer: :sequen
         base_resource.merge('deleted' => false)
       end
 
-      it 'adds groups' do # rubocop:disable RSpec/MultipleExpectations
+      it 'adds groups', :aggregate_failures do
         expect { process(process_payload) }.to change(Group, :count).by(1)
         expect(Group.last).to have_attributes(
           name:   'Additional Group',
@@ -51,7 +51,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Zendesk::Group, sequencer: :sequen
         base_resource.merge('deleted' => true)
       end
 
-      it 'adds groups' do # rubocop:disable RSpec/MultipleExpectations
+      it 'adds groups', :aggregate_failures do
         expect { process(process_payload) }.to change(Group, :count).by(1)
         expect(Group.last).to have_attributes(
           name:   'Additional Group',

+ 1 - 4
spec/lib/user_agent_spec.rb

@@ -3,10 +3,9 @@
 require 'rails_helper'
 require 'rack/handler/puma'
 
-# rubocop:disable RSpec/MultipleExpectations
 # this cop is disabled to speed up testing by avoiding the overhead of multiple requests
 
-RSpec.describe UserAgent, integration: true do
+RSpec.describe UserAgent, :aggregate_failures, integration: true do
   include ZammadSpecSupportRequest
 
   def host_with_port
@@ -568,5 +567,3 @@ RSpec.describe UserAgent, integration: true do
     include_context 'when doing user agent tests'
   end
 end
-
-# rubocop:enable RSpec/MultipleExpectations

+ 1 - 1
spec/models/channel/driver/facebook_spec.rb

@@ -23,7 +23,7 @@ RSpec.describe Channel::Driver::Facebook, use_vcr: true, performs_jobs: true, re
   # export FACEBOOK_PAGE_1_POST_ID=placeholder
   # export FACEBOOK_PAGE_1_POST_COMMENT_ID=placeholder
   #
-  it 'tests full run' do # rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
+  it 'tests full run', :aggregate_failures do # rubocop:disable RSpec/ExampleLength
     allow(ApplicationHandleInfo).to receive('context=')
     ExternalCredential.create name: :facebook, credentials: { application_id: ENV['FACEBOOK_APPLICATION_ID'], application_secret: ENV['FACEBOOK_APPLICATION_SECRET'] }
 

+ 1 - 1
spec/models/channel/driver/sms/massenversand_spec.rb

@@ -52,7 +52,7 @@ RSpec.describe Channel::Driver::Sms::Massenversand do
     context 'when receiver is blocked' do
       let(:body) { 'blocked receiver ()' }
 
-      it 'raises RuntimeError' do # rubocop:disable RSpec/MultipleExpectations
+      it 'raises RuntimeError', :aggregate_failures do
         expect { instance.send(channel.options, { recipient: receiver_number, message: message_body }) }.to raise_error { |error|
           expect(error.message).not_to include(body)
         }