lib/rubocop/cop/rspec/mixin/top_level_group.rb in rubocop-rspec-3.2.0 vs lib/rubocop/cop/rspec/mixin/top_level_group.rb in rubocop-rspec-3.3.0
- old
+ new
@@ -5,10 +5,14 @@
module RSpec
# Helper methods for top level example group cops
module TopLevelGroup
extend RuboCop::NodePattern::Macros
+ DEPRECATED_MODULE_METHOD_WARNING =
+ 'top_level_group? is deprecated and will be ' \
+ 'removed in the next major version of rubocop_rspec.'
+
def on_new_investigation
super
top_level_groups.each do |node|
on_top_level_example_group(node) if example_group?(node)
@@ -26,10 +30,13 @@
# Dummy methods to be overridden in the consumer
def on_top_level_example_group(_node); end
def on_top_level_group(_node); end
+ # @private
+ # @deprecated All callers of this method have been removed.
def top_level_group?(node)
+ warn DEPRECATED_MODULE_METHOD_WARNING, uplevel: 1
top_level_groups.include?(node)
end
def top_level_nodes(node)
return [] if node.nil?