From 1b00997cd177a8c8e285b8606603cc8cef1a9c38 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 20 Oct 2017 17:59:45 +0900 Subject: [PATCH] Fix offenses of naming/variable_name_spec.rb Fix the following offenses. ```console % bundle exec rake internal_investigation (snip) Offenses: spec/rubocop/cop/naming/variable_name_spec.rb:138:5: C: Don't repeat examples within an example group. it 'registers an offense for snake case in method parameter' do ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/rubocop/cop/naming/variable_name_spec.rb:149:5: C: Don't repeat examples within an example group. it 'registers an offense for method arguments' do ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1019 files inspected, 2 offenses detected RuboCop failed! ``` This commit removes a redundant test. The following tests are the same. - https://github.com/bbatsov/rubocop/blob/834262bf83f00462333245547727e102736daccd/spec/rubocop/cop/naming/variable_name_spec.rb#L138-L143 - https://github.com/bbatsov/rubocop/blob/834262bf83f00462333245547727e102736daccd/spec/rubocop/cop/naming/variable_name_spec.rb#L149-L154 I left a more clearer explanation test. --- spec/rubocop/cop/naming/variable_name_spec.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/spec/rubocop/cop/naming/variable_name_spec.rb b/spec/rubocop/cop/naming/variable_name_spec.rb index 78b4c75232d8..e8d93697138b 100644 --- a/spec/rubocop/cop/naming/variable_name_spec.rb +++ b/spec/rubocop/cop/naming/variable_name_spec.rb @@ -146,13 +146,6 @@ def method(funny_arg); end expect_no_offenses('_myLocal = 1') end - it 'registers an offense for method arguments' do - expect_offense(<<-RUBY.strip_indent) - def method(funny_arg); end - ^^^^^^^^^ Use camelCase for variable names. - RUBY - end - it 'registers an offense for default method arguments' do expect_offense(<<-RUBY.strip_indent) def foo(opt_arg = 1); end