lib/rubocop/cop/rspec/describe_class.rb in rubocop-rspec-1.4.1 vs lib/rubocop/cop/rspec/describe_class.rb in rubocop-rspec-1.5.0
- old
+ new
@@ -22,20 +22,21 @@
include RuboCop::RSpec::TopLevelDescribe
REQUEST_PAIR = s(:pair, s(:sym, :type), s(:sym, :request))
FEATURE_PAIR = s(:pair, s(:sym, :type), s(:sym, :feature))
ROUTING_PAIR = s(:pair, s(:sym, :type), s(:sym, :routing))
+ VIEW_PAIR = s(:pair, s(:sym, :type), s(:sym, :view))
MESSAGE = 'The first argument to describe should be the class or ' \
'module being tested.'.freeze
def on_top_level_describe(_node, args)
return if args[0] && args[0].type == :const
return if args[1..-1].any? do |arg|
next unless arg.hash_type?
arg.children.any? do |n|
- [REQUEST_PAIR, FEATURE_PAIR, ROUTING_PAIR].include?(n)
+ [REQUEST_PAIR, FEATURE_PAIR, ROUTING_PAIR, VIEW_PAIR].include?(n)
end
end
add_offense(args[0], :expression, MESSAGE)
end