Просмотр исходного кода

Maintenance: Update dependency rubocop-rspec to v2.14.2

renovatebot 2 лет назад
Родитель
Сommit
1c6fdb28e6

+ 0 - 63
.rubocop/cop/zammad/have_no_over_not_to.rb

@@ -1,63 +0,0 @@
-# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
-
-require 'capybara/rspec/matchers'
-
-module RuboCop
-  module Cop
-    module Zammad
-      # This cop is used to identify usages of `have_*` RSpec matcher together with `not_to`.
-      # `have_no_*` with `to` is preferred
-      #
-      # @example
-      #   # bad
-      #   expect(page).not_to have_css('#elem')
-      #
-      #   # good
-      #   expect(page).to have_no_css('#elem')
-      class HaveNoOverNotTo < Base
-        extend AutoCorrector
-
-        MSG = 'Prefer `.to %<replacement>s` over `.not_to %<original>s`.'.freeze
-
-        def_node_matcher :on_have_not_no, '(send (send nil? :expect ...) :not_to (send nil? #matcher_to_replace? ...))'
-
-        def matcher_to_replace?(matcher_name)
-          have_not_no?(matcher_name) && capybara_matcher?(matcher_name)
-        end
-
-        def have_not_no?(matcher_name)  # rubocop:disable Naming/PredicateName
-          matcher_name.match?(%r{^have_(?!no)})
-        end
-
-        def capybara_matcher?(matcher_name)
-          Capybara::RSpecMatchers.instance_methods.include?(matcher_name)
-        end
-
-        def on_send(node)
-          on_have_not_no(node) do
-            add_offense(node, message: message(node)) do |corrector|
-              corrector.replace(original_matcher_node(node).loc.selector, alternative_matcher(node))
-              corrector.replace(node.loc.selector, 'to')
-            end
-          end
-        end
-
-        def original_matcher_node(node)
-          node.children[2]
-        end
-
-        def original_matcher(node)
-          original_matcher_node(node).method_name
-        end
-
-        def alternative_matcher(node)
-          original_matcher(node).to_s.sub 'have_', 'have_no_'
-        end
-
-        def message(node)
-          format(MSG, replacement: alternative_matcher(node), original: original_matcher(node))
-        end
-      end
-    end
-  end
-end

+ 12 - 0
.rubocop/default.yml

@@ -371,11 +371,23 @@ RSpec/AnyInstance:
 RSpec/SubjectStub:
   Enabled: false
 
+RSpec/Rails/InferredSpecType:
+  Description: 'Identifies redundant spec type.'
+  Enabled: false  # We use types to add DSL to rspec.
+
 RSpec/Capybara/SpecificFinders:
   Description: 'Checks if there is a more specific finder offered by Capybara.'
   Enabled: false
   # False positives, autocorrection makes weird suggestions.
 
+RSpec/Capybara/SpecificActions:
+  Description: 'Checks for there is a more specific actions offered by Capybara.'
+  Enabled: false
+
+RSpec/Capybara/NegationMatcher:
+  Description: Enforces use of have_no_* or not_to for negated expectations.
+  EnforcedStyle: have_no
+
 RSpec/ExampleLength:
   CountAsOne:
     - 'array'

+ 0 - 1
.rubocop/rubocop_zammad.rb

@@ -7,7 +7,6 @@ require_relative 'cop/zammad/exists_date_time_precision'
 require_relative 'cop/zammad/exists_db_strategy'
 require_relative 'cop/zammad/exists_reset_column_information'
 require_relative 'cop/zammad/correct_migration_timestamp'
-require_relative 'cop/zammad/have_no_over_not_to'
 require_relative 'cop/zammad/no_to_sym_on_string'
 require_relative 'cop/zammad/prefer_negated_if_over_unless'
 require_relative 'cop/zammad/update_copyright'

+ 1 - 1
Gemfile.lock

@@ -478,7 +478,7 @@ GEM
       activesupport (>= 4.2.0)
       rack (>= 1.1)
       rubocop (>= 1.33.0, < 2.0)
-    rubocop-rspec (2.13.2)
+    rubocop-rspec (2.14.2)
       rubocop (~> 1.33)
     ruby-progressbar (1.11.0)
     ruby-saml (1.14.0)

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue2641KbColorChangeLimit, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue2641KbColorChangeLimit, db_strategy: :reset, type: :db_migration do
   subject(:knowledge_base) { create(:knowledge_base) }
 
   before do

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue2368AddIndicesToHistoriesAndTickets, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue2368AddIndicesToHistoriesAndTickets, db_strategy: :reset, type: :db_migration do
 
   before { without_index(table, column: columns) }
 

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue2401ConvertUserLoginEmailToUnicode, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue2401ConvertUserLoginEmailToUnicode, db_strategy: :reset, type: :db_migration do
   describe 'when user login/email has punycode formatted domain' do
     def create_user
       now = DateTime.now.strftime('%Y-%m-%d %H:%M:%S.000')

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue2867FooterHeaderPublicLink, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue2867FooterHeaderPublicLink, db_strategy: :reset, type: :db_migration do
 
   before { without_column(table, column: column) }
 

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue3550SetPretty, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue3550SetPretty, db_strategy: :reset, type: :db_migration do
   context 'when cti gets migrated to stored pretty values' do
     let!(:cti) { create(:'cti/log') }
 

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

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe Issue3567AutoAssignment, type: :db_migration, db_strategy: :reset do
+RSpec.describe Issue3567AutoAssignment, db_strategy: :reset, type: :db_migration do
   context 'when setting contains article keys' do
     before do
       Setting.set('ticket_auto_assignment_selector', { 'condition'=>{ 'article.subject'=>{ 'operator' => 'contains', 'value' => 'test' } } })

Некоторые файлы не были показаны из-за большого количества измененных файлов