From e3e746623b2fa6c45dab66dd1618810a53cdecd8 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Tue, 28 Aug 2018 10:58:36 +0200 Subject: Handles when ClassMethods is used inside a class --- spec/rubocop/cop/prefer_class_methods_over_module_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/rubocop') diff --git a/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb b/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb index 527c236eecf..ec60a651f31 100644 --- a/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb +++ b/spec/rubocop/cop/prefer_class_methods_over_module_spec.rb @@ -48,6 +48,17 @@ describe RuboCop::Cop::PreferClassMethodsOverModule do RUBY end + it "doesn't flag violation when ClassMethods is used inside a class" do + expect_no_offenses(<<~RUBY) + class Foo + module ClassMethods + def a_class_method + end + end + end + RUBY + end + it "doesn't flag violation when not using either class_methods or ClassMethods" do expect_no_offenses(<<~RUBY) module Foo -- cgit v1.2.1