Browse Source

Maintenance: Enable RSpec/AlignLeftLetBrace cop

Florian Liebe 2 years ago
parent
commit
5074f76f37

+ 4 - 0
.rubocop/default.yml

@@ -339,6 +339,10 @@ RSpec/Rails/AvoidSetupHook:
   Exclude:
     - "test/**/*"
 
+RSpec/AlignLeftLetBrace:
+  Description: 'Checks that left braces for adjacent single line lets are aligned.'
+  Enabled: true
+
 Zammad/PreferNegatedIfOverUnless:
   Exclude:
     - 'bin/rspec'

+ 2 - 2
spec/controllers/application_controller/has_download/download_file_spec.rb

@@ -6,8 +6,8 @@ RSpec.describe ApplicationController::HasDownload::DownloadFile do
   subject(:download_file) { described_class.new(stored_file.id, disposition: 'inline') }
 
   let(:file_content_type) { 'application/pdf' }
-  let(:file_data) { 'A example file.' }
-  let(:file_name) { 'example.pdf' }
+  let(:file_data)         { 'A example file.' }
+  let(:file_name)         { 'example.pdf' }
 
   let(:stored_file) do
     create(:store,

+ 4 - 4
spec/db/migrate/20171023000001_fixed_store_upgrade_ror_45_spec.rb

@@ -28,11 +28,11 @@ RSpec.describe FixedStoreUpgradeRor45, type: :db_migration do
       SQL
     end
 
-    let(:mysql?) { ActiveRecord::Base.connection_db_config.configuration_hash[:adapter] == 'mysql2' }
-    let(:user) { User.last }
+    let(:mysql?)       { ActiveRecord::Base.connection_db_config.configuration_hash[:adapter] == 'mysql2' }
+    let(:user)         { User.last }
     let(:last_contact) { '2017-09-01 10:10:00' }
-    let(:state) { ActionController::Parameters.new('ticket' => {}, 'article' => {}) }
-    let(:params) { ActionController::Parameters.new('ticket_id' => 1234, 'shown' => true) }
+    let(:state)        { ActionController::Parameters.new('ticket' => {}, 'article' => {}) }
+    let(:params)       { ActionController::Parameters.new('ticket_id' => 1234, 'shown' => true) }
     let(:preferences) do
       ActionController::Parameters.new(
         'tasks' => [

+ 1 - 1
spec/db/migrate/issue3123_external_sync_ticket_merge_spec.rb

@@ -4,7 +4,7 @@ require 'rails_helper'
 
 RSpec.describe Issue3123ExternalSyncTicketMerge, type: :db_migration do
 
-  let(:user) { create(:agent) }
+  let(:user)          { create(:agent) }
   let(:source_ticket) { create(:ticket) }
   let(:target_ticket) { create(:ticket) }
 

+ 2 - 2
spec/db/migrate/issue_2460_fix_corrupted_twitter_ids_spec.rb

@@ -5,8 +5,8 @@ require 'rails_helper'
 RSpec.describe Issue2460FixCorruptedTwitterIds, type: :db_migration do
   before { allow(Twitter::REST::Client).to receive(:new).and_return(client) }
 
-  let(:client) { double('Twitter::REST::Client', user: twitter_api_user) }
-  let(:twitter_api_user) { double('Twitter::User', id: twitter_api_user_id) }
+  let(:client)              { double('Twitter::REST::Client', user: twitter_api_user) }
+  let(:twitter_api_user)    { double('Twitter::User', id: twitter_api_user_id) }
   let(:twitter_api_user_id) { 1234567890 } # rubocop:disable Style/NumericLiterals
 
   context 'with existing, corrupted Twitter channel' do

+ 1 - 1
spec/db/migrate/issue_2671_pending_till_can_be_changed_by_customer_spec.rb

@@ -3,7 +3,7 @@
 require 'rails_helper'
 
 RSpec.describe Issue2671PendingTillCanBeChangedByCustomer, type: :db_migration do
-  let(:attr) { ObjectManager::Attribute.find_by name: :pending_time }
+  let(:attr)                { ObjectManager::Attribute.find_by name: :pending_time }
   let(:initial_data_option) { { future: true, past: true, diff: 0 } }
 
   before do

+ 1 - 1
spec/db/migrate/issue_3851_spec.rb

@@ -4,7 +4,7 @@ require 'rails_helper'
 
 RSpec.describe Issue3851, type: :db_migration do
   let(:follow_up_assignment) { ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_assignment') }
-  let(:follow_up_possible) { ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_possible') }
+  let(:follow_up_possible)   { ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_possible') }
 
   before do
     migrate

+ 2 - 2
spec/db/migrate/remove_duplicate_translations_spec.rb

@@ -9,8 +9,8 @@ RSpec.describe RemoveDuplicateTranslations, type: :db_migration do
   end
 
   context 'when having unsynchronized entries with duplicates' do
-    let!(:unrelated_entry_one) { create_translation({ source: 'unknown entry', target: 'unknown translation', is_synchronized_from_codebase: false }) }
-    let!(:unrelated_entry_two) { create_translation({ source: 'unknown entry', target: 'unknown translation', is_synchronized_from_codebase: false }) }
+    let!(:unrelated_entry_one)   { create_translation({ source: 'unknown entry', target: 'unknown translation', is_synchronized_from_codebase: false }) }
+    let!(:unrelated_entry_two)   { create_translation({ source: 'unknown entry', target: 'unknown translation', is_synchronized_from_codebase: false }) }
     let!(:unrelated_entry_three) { create_translation({ source: 'unknown entry', target: 'unknown translation', is_synchronized_from_codebase: false }) }
 
     before do

+ 1 - 1
spec/db/migrate/set_user_source_ldap_from_external_sync_spec.rb

@@ -3,7 +3,7 @@
 require 'rails_helper'
 
 RSpec.describe SetUserSourceLdapFromExternalSync, type: :db_migration, db_strategy: :reset do
-  let(:users) { create_list(:user, 2) }
+  let(:users)      { create_list(:user, 2) }
   let(:other_user) { create(:user) }
 
   before do

+ 5 - 5
spec/graphql/gql/mutations/form/upload_cache/add_spec.rb

@@ -5,11 +5,11 @@ require 'rails_helper'
 RSpec.describe Gql::Mutations::Form::UploadCache::Add, type: :graphql do
 
   context 'when uploading files for a form', authenticated_as: :agent do
-    let(:agent) { create(:agent) }
-    let(:query) { read_graphql_file('shared/components/Form/fields/FieldFile/graphql/mutations/uploadCache/add.graphql') }
-    let(:form_id) { 12_345 }
-    let(:file_name) { 'my_testfile.pdf' }
-    let(:file_type) { 'application/pdf' }
+    let(:agent)        { create(:agent) }
+    let(:query)        { read_graphql_file('shared/components/Form/fields/FieldFile/graphql/mutations/uploadCache/add.graphql') }
+    let(:form_id)      { 12_345 }
+    let(:file_name)    { 'my_testfile.pdf' }
+    let(:file_type)    { 'application/pdf' }
     let(:file_content) { 'some test content' }
     let(:variables) do
       {

Some files were not shown because too many files changed in this diff