lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.8.0 vs lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.9.0
- old
+ new
@@ -18,23 +18,20 @@
# # good
# describe MyClass do
# subject { described_class.do_something }
# end
class DescribedClass < Cop
- include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe
+ include RuboCop::RSpec::TopLevelDescribe
DESCRIBED_CLASS = 'described_class'.freeze
MSG = "Use `#{DESCRIBED_CLASS}` instead of `%s`".freeze
- RSPEC_BLOCK_METHODS = RuboCop::RSpec::Language::ALL.to_node_pattern
-
def_node_matcher :common_instance_exec_closure?, <<-PATTERN
(block (send (const nil {:Class :Module}) :new ...) ...)
PATTERN
- def_node_matcher :rspec_block?, <<-PATTERN
- (block (send nil {#{RSPEC_BLOCK_METHODS}} ...) ...)
- PATTERN
+ def_node_matcher :rspec_block?,
+ RuboCop::RSpec::Language::ALL.block_pattern
def_node_matcher :scope_changing_syntax?, '{def class module}'
def on_block(node)
describe, described_class, body = described_constant(node)