diff --git a/lib/rubocop/cop/obsession/rspec/describe_public_method.rb b/lib/rubocop/cop/obsession/rspec/describe_public_method.rb index 3b4fc42..d923d00 100644 --- a/lib/rubocop/cop/obsession/rspec/describe_public_method.rb +++ b/lib/rubocop/cop/obsession/rspec/describe_public_method.rb @@ -94,13 +94,7 @@ def tested_file_path end def parse_file(file_path) - parser_class = ::Parser.const_get(:"Ruby#{target_ruby_version.to_s.sub('.', '')}") - parser = parser_class.new(RuboCop::AST::Builder.new) - - buffer = Parser::Source::Buffer.new(file_path, 1) - buffer.source = File.read(file_path) - - parser.parse(buffer) + parse(File.read(file_path)).ast end def find_private_methods(class_node)