aboutsummaryrefslogtreecommitdiffstats
path: root/ci/custom_cops/test/custom_cops/refute_not_test.rb
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2018-07-03 12:11:28 +0900
committerKoichi ITO <koic.ito@gmail.com>2018-07-26 17:48:07 +0900
commit211b10aea6313582e2f837edd297af4aeb33c8dc (patch)
tree9e5b037b2d9ae2b65182d154fd7426bed3b14a20 /ci/custom_cops/test/custom_cops/refute_not_test.rb
parent91fd679710118482f718ea710710561f1cfb0b70 (diff)
downloadrails-211b10aea6313582e2f837edd297af4aeb33c8dc.tar.gz
rails-211b10aea6313582e2f837edd297af4aeb33c8dc.tar.bz2
rails-211b10aea6313582e2f837edd297af4aeb33c8dc.zip
Bump RuboCop to 0.58.2
## Summary RuboCop 0.58.2 was released. https://github.com/rubocop-hq/rubocop/releases/tag/v0.58.2 And rubocop-0-58 channel is available in Code Climate. https://github.com/codeclimate/codeclimate/releases/tag/v0.76.0 https://github.com/codeclimate/codeclimate/commit/38f21f0 In addition, the following changes are made in this PR. - Replace Custom cops with Rails cops - Add jaro_winkler gem to Gemfile.lock ### Replace Custom cops with Rails cops These are compatible replacements. - Replace `CustomCops/AssertNot` cop with `Rails/AssertNot` cop. - Replace `CustomCops/RefuteNot` cop with `Rails/RefuteMethods` cop. With this replacement, it was decided to use cop of RuboCop itself. It removes the code related to CustomCops accordingly. ### Add jaro_winkler gem to Gemfile.lock Since RuboCop 0.57.0 depends on jaro_winkler gem, it has been added to Gemfile.lock.
Diffstat (limited to 'ci/custom_cops/test/custom_cops/refute_not_test.rb')
-rw-r--r--ci/custom_cops/test/custom_cops/refute_not_test.rb66
1 files changed, 0 insertions, 66 deletions
diff --git a/ci/custom_cops/test/custom_cops/refute_not_test.rb b/ci/custom_cops/test/custom_cops/refute_not_test.rb
deleted file mode 100644
index f0f6eaeda0..0000000000
--- a/ci/custom_cops/test/custom_cops/refute_not_test.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# frozen_string_literal: true
-
-require "support/cop_helper"
-require_relative "../../lib/custom_cops/refute_not"
-
-class RefuteNotTest < ActiveSupport::TestCase
- include CopHelper
-
- setup do
- @cop = CustomCops::RefuteNot.new
- end
-
- {
- refute: :assert_not,
- refute_empty: :assert_not_empty,
- refute_equal: :assert_not_equal,
- refute_in_delta: :assert_not_in_delta,
- refute_in_epsilon: :assert_not_in_epsilon,
- refute_includes: :assert_not_includes,
- refute_instance_of: :assert_not_instance_of,
- refute_kind_of: :assert_not_kind_of,
- refute_nil: :assert_not_nil,
- refute_operator: :assert_not_operator,
- refute_predicate: :assert_not_predicate,
- refute_respond_to: :assert_not_respond_to,
- refute_same: :assert_not_same,
- refute_match: :assert_no_match
- }.each do |refute_method, assert_method|
- test "rejects `#{refute_method}` with a single argument" do
- inspect_source(@cop, "#{refute_method} a")
- assert_offense @cop, offense_message(refute_method, assert_method)
- end
-
- test "rejects `#{refute_method}` with multiple arguments" do
- inspect_source(@cop, "#{refute_method} a, b, c")
- assert_offense @cop, offense_message(refute_method, assert_method)
- end
-
- test "autocorrects `#{refute_method}` with a single argument" do
- corrected = autocorrect_source(@cop, "#{refute_method} a")
- assert_equal "#{assert_method} a", corrected
- end
-
- test "autocorrects `#{refute_method}` with multiple arguments" do
- corrected = autocorrect_source(@cop, "#{refute_method} a, b, c")
- assert_equal "#{assert_method} a, b, c", corrected
- end
-
- test "accepts `#{assert_method}` with a single argument" do
- inspect_source(@cop, "#{assert_method} a")
- assert_empty @cop.offenses
- end
-
- test "accepts `#{assert_method}` with multiple arguments" do
- inspect_source(@cop, "#{assert_method} a, b, c")
- assert_empty @cop.offenses
- end
- end
-
- private
-
- def offense_message(refute_method, assert_method)
- carets = "^" * refute_method.to_s.length
- "#{carets} Prefer `#{assert_method}` over `#{refute_method}`"
- end
-end