lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.42.0 vs lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.43.0
- old
+ new
@@ -27,11 +27,11 @@
# end
#
# # good
# it 'does things' do
# end
- class ExampleWording < Cop
+ class ExampleWording < Base
extend AutoCorrector
MSG_SHOULD = 'Do not use should when describing your tests.'
MSG_IT = "Do not repeat 'it' when describing your tests."
@@ -45,13 +45,13 @@
} ...) ...)
PATTERN
def on_block(node)
it_description(node) do |description_node, message|
- if message =~ SHOULD_PREFIX
+ if message.match?(SHOULD_PREFIX)
add_wording_offense(description_node, MSG_SHOULD)
- elsif message =~ IT_PREFIX
+ elsif message.match?(IT_PREFIX)
add_wording_offense(description_node, MSG_IT)
end
end
end
@@ -75,10 +75,10 @@
end
def replacement_text(node)
text = text(node)
- if text =~ SHOULD_PREFIX
+ if text.match?(SHOULD_PREFIX)
RuboCop::RSpec::Wording.new(
text,
ignore: ignored_words,
replace: custom_transform
).rewrite