Permalink
Browse files

Use here-document for example sources in specs for readability

The array-of-lines style is hard to read. It's usable only when there're
trailing whitespaces in the example source.

Standard
--------

The following source:

```
source = [
  'def some_method',
  '  body',
  'end'
]
END
```

... should be converted to:

```
source = <<-END.strip_indent
  def some_method
    body
  end
END
```

With indentations
-----------------

The following source:

```
source = [
  '  def some_method',
  '    body',
  '  end'
]
END
```

... should be converted to:

```
source = <<-END.strip_margin('|')
  |  def some_method
  |    body
  |  end
END
```

With trailing whitespaces
-------------------------

The following source does _not_ need to be converted:

```
source = [
  'def some_method',
  '  body ',
  'end'
]
END
```
  • Loading branch information...
yujinakayama authored and bbatsov committed Apr 9, 2017
1 parent 6acc6c5 commit 3c71da31aa37282281785a09dfa3ae234bae0fcb
Showing with 23,118 additions and 17,727 deletions.
  1. +55 −43 spec/rubocop/cli/cli_auto_gen_config_spec.rb
  2. +706 −602 spec/rubocop/cli/cli_autocorrect_spec.rb
  3. +190 −143 spec/rubocop/cli/cli_options_spec.rb
  4. +591 −409 spec/rubocop/cli_spec.rb
  5. +178 −143 spec/rubocop/config_loader_spec.rb
  6. +62 −62 spec/rubocop/config_spec.rb
  7. +49 −43 spec/rubocop/cop/bundler/ordered_gems_spec.rb
  8. +24 −24 spec/rubocop/cop/lint/ambiguous_operator_spec.rb
  9. +68 −51 spec/rubocop/cop/lint/assignment_in_condition_spec.rb
  10. +427 −346 spec/rubocop/cop/lint/block_alignment_spec.rb
  11. +50 −50 spec/rubocop/cop/lint/circular_argument_reference_spec.rb
  12. +17 −14 spec/rubocop/cop/lint/condition_position_spec.rb
  13. +15 −9 spec/rubocop/cop/lint/debugger_spec.rb
  14. +27 −21 spec/rubocop/cop/lint/def_end_alignment_spec.rb
  15. +78 −60 spec/rubocop/cop/lint/duplicate_case_condition_spec.rb
  16. +10 −8 spec/rubocop/cop/lint/duplicate_methods_spec.rb
  17. +32 −28 spec/rubocop/cop/lint/else_layout_spec.rb
  18. +26 −23 spec/rubocop/cop/lint/empty_ensure_spec.rb
  19. +32 −26 spec/rubocop/cop/lint/empty_expression_spec.rb
  20. +104 −92 spec/rubocop/cop/lint/empty_when_spec.rb
  21. +21 −15 spec/rubocop/cop/lint/end_alignment_spec.rb
  22. +10 −6 spec/rubocop/cop/lint/end_in_method_spec.rb
  23. +22 −19 spec/rubocop/cop/lint/ensure_return_spec.rb
  24. +28 −14 spec/rubocop/cop/lint/format_parameter_mismatch_spec.rb
  25. +15 −13 spec/rubocop/cop/lint/handle_exceptions_spec.rb
  26. +53 −43 spec/rubocop/cop/lint/ineffective_access_modifier_spec.rb
  27. +90 −72 spec/rubocop/cop/lint/literal_in_condition_spec.rb
  28. +136 −106 spec/rubocop/cop/lint/nested_method_definition_spec.rb
  29. +9 −5 spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb
  30. +27 −15 spec/rubocop/cop/lint/require_parentheses_spec.rb
  31. +82 −71 spec/rubocop/cop/lint/rescue_exception_spec.rb
  32. +336 −258 spec/rubocop/cop/lint/shadowed_exception_spec.rb
  33. +97 −97 spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
  34. +145 −101 spec/rubocop/cop/lint/unneeded_splat_expansion_spec.rb
  35. +23 −18 spec/rubocop/cop/lint/unreachable_code_spec.rb
  36. +18 −10 spec/rubocop/cop/lint/unused_method_argument_spec.rb
  37. +490 −404 spec/rubocop/cop/lint/useless_access_modifier_spec.rb
  38. +800 −798 spec/rubocop/cop/lint/useless_assignment_spec.rb
  39. +8 −6 spec/rubocop/cop/lint/useless_comparison_spec.rb
  40. +16 −16 spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
  41. +102 −86 spec/rubocop/cop/lint/useless_setter_call_spec.rb
  42. +31 −24 spec/rubocop/cop/lint/void_spec.rb
  43. +44 −30 spec/rubocop/cop/metrics/abc_size_spec.rb
  44. +88 −64 spec/rubocop/cop/metrics/block_length_spec.rb
  45. +146 −114 spec/rubocop/cop/metrics/block_nesting_spec.rb
  46. +109 −91 spec/rubocop/cop/metrics/class_length_spec.rb
  47. +132 −98 spec/rubocop/cop/metrics/cyclomatic_complexity_spec.rb
  48. +8 −6 spec/rubocop/cop/metrics/line_length_spec.rb
  49. +127 −101 spec/rubocop/cop/metrics/method_length_spec.rb
  50. +156 −134 spec/rubocop/cop/metrics/module_length_spec.rb
  51. +20 −10 spec/rubocop/cop/metrics/parameter_lists_spec.rb
  52. +142 −106 spec/rubocop/cop/metrics/perceived_complexity_spec.rb
  53. +12 −8 spec/rubocop/cop/offense_spec.rb
  54. +341 −265 spec/rubocop/cop/performance/case_when_splat_spec.rb
  55. +8 −4 spec/rubocop/cop/performance/casecmp_spec.rb
  56. +6 −4 spec/rubocop/cop/performance/compare_with_block_spec.rb
  57. +41 −25 spec/rubocop/cop/performance/count_spec.rb
  58. +40 −24 spec/rubocop/cop/performance/detect_spec.rb
  59. +12 −6 spec/rubocop/cop/performance/fixed_size_spec.rb
  60. +119 −75 spec/rubocop/cop/performance/redundant_block_call_spec.rb
  61. +53 −33 spec/rubocop/cop/performance/redundant_match_spec.rb
  62. +129 −83 spec/rubocop/cop/performance/redundant_merge_spec.rb
  63. +6 −4 spec/rubocop/cop/performance/redundant_sort_by_spec.rb
  64. +33 −17 spec/rubocop/cop/performance/string_replacement_spec.rb
  65. +41 −27 spec/rubocop/cop/rails/blank_spec.rb
  66. +103 −77 spec/rubocop/cop/rails/delegate_spec.rb
  67. +14 −12 spec/rubocop/cop/rails/dynamic_find_by_spec.rb
  68. +4 −2 spec/rubocop/cop/rails/enum_uniqueness_spec.rb
  69. +14 −13 spec/rubocop/cop/rails/http_positional_arguments_spec.rb
  70. +15 −13 spec/rubocop/cop/rails/not_null_column_spec.rb
  71. +20 −10 spec/rubocop/cop/rails/output_safety_spec.rb
  72. +15 −9 spec/rubocop/cop/rails/output_spec.rb
  73. +34 −22 spec/rubocop/cop/rails/present_spec.rb
  74. +19 −18 spec/rubocop/cop/rails/read_write_attribute_spec.rb
  75. +47 −37 spec/rubocop/cop/rails/relative_date_constant_spec.rb
  76. +5 −3 spec/rubocop/cop/rails/save_bang_spec.rb
  77. +5 −3 spec/rubocop/cop/rails/scope_args_spec.rb
  78. +301 −262 spec/rubocop/cop/style/access_modifier_indentation_spec.rb
  79. +50 −30 spec/rubocop/cop/style/accessor_method_name_spec.rb
  80. +68 −44 spec/rubocop/cop/style/alias_spec.rb
  81. +105 −79 spec/rubocop/cop/style/align_array_spec.rb
  82. +288 −200 spec/rubocop/cop/style/align_hash_spec.rb
  83. +419 −291 spec/rubocop/cop/style/align_parameters_spec.rb
  84. +52 −32 spec/rubocop/cop/style/and_or_spec.rb
  85. +8 −6 spec/rubocop/cop/style/ascii_comments_spec.rb
  86. +8 −6 spec/rubocop/cop/style/ascii_identifiers_spec.rb
  87. +5 −3 spec/rubocop/cop/style/attr_spec.rb
  88. +5 −3 spec/rubocop/cop/style/bare_percent_literals_spec.rb
  89. +31 −22 spec/rubocop/cop/style/block_comments_spec.rb
  90. +158 −101 spec/rubocop/cop/style/block_delimiters_spec.rb
  91. +25 −16 spec/rubocop/cop/style/block_end_newline_spec.rb
  92. +12 −8 spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb
  93. +277 −225 spec/rubocop/cop/style/case_indentation_spec.rb
  94. +21 −18 spec/rubocop/cop/style/class_and_module_camel_case_spec.rb
  95. +78 −64 spec/rubocop/cop/style/class_and_module_children_spec.rb
  96. +49 −40 spec/rubocop/cop/style/class_methods_spec.rb
  97. +157 −97 spec/rubocop/cop/style/closing_parenthesis_indentation_spec.rb
  98. +9 −6 spec/rubocop/cop/style/comment_annotation_spec.rb
  99. +127 −109 spec/rubocop/cop/style/comment_indentation_spec.rb
  100. +589 −449 spec/rubocop/cop/style/conditional_assignment_assign_in_condition_spec.rb
  101. +1,425 −1,113 spec/rubocop/cop/style/conditional_assignment_assign_to_condition_spec.rb
  102. +9 −7 spec/rubocop/cop/style/constant_name_spec.rb
  103. +22 −12 spec/rubocop/cop/style/def_with_parentheses_spec.rb
  104. +198 −171 spec/rubocop/cop/style/documentation_spec.rb
  105. +89 −49 spec/rubocop/cop/style/dot_position_spec.rb
  106. +60 −24 spec/rubocop/cop/style/each_for_simple_loop_spec.rb
  107. +60 −48 spec/rubocop/cop/style/each_with_object_spec.rb
  108. +332 −288 spec/rubocop/cop/style/else_alignment_spec.rb
  109. +94 −70 spec/rubocop/cop/style/empty_case_condition_spec.rb
  110. +51 −31 spec/rubocop/cop/style/empty_line_after_magic_comment_spec.rb
  111. +293 −224 spec/rubocop/cop/style/empty_line_between_defs_spec.rb
  112. +147 −126 spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb
  113. +9 −7 spec/rubocop/cop/style/empty_lines_around_block_body_spec.rb
  114. +188 −157 spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb
  115. +51 −40 spec/rubocop/cop/style/empty_lines_around_method_body_spec.rb
  116. +159 −136 spec/rubocop/cop/style/empty_lines_around_module_body_spec.rb
  117. +9 −7 spec/rubocop/cop/style/empty_lines_spec.rb
  118. +15 −9 spec/rubocop/cop/style/empty_literal_spec.rb
  119. +99 −54 spec/rubocop/cop/style/encoding_spec.rb
  120. +14 −14 spec/rubocop/cop/style/even_odd_spec.rb
  121. +242 −193 spec/rubocop/cop/style/extra_spacing_spec.rb
  122. +53 −56 spec/rubocop/cop/style/file_name_spec.rb
  123. +52 −28 spec/rubocop/cop/style/first_array_element_line_break_spec.rb
  124. +38 −24 spec/rubocop/cop/style/first_hash_element_line_break_spec.rb
  125. +34 −23 spec/rubocop/cop/style/first_method_argument_line_break_spec.rb
  126. +58 −43 spec/rubocop/cop/style/first_method_parameter_line_break_spec.rb
  127. +214 −138 spec/rubocop/cop/style/first_parameter_indentation_spec.rb
  128. +10 −8 spec/rubocop/cop/style/flip_flop_spec.rb
  129. +53 −46 spec/rubocop/cop/style/for_spec.rb
  130. +322 −198 spec/rubocop/cop/style/frozen_string_literal_comment_spec.rb
  131. +199 −175 spec/rubocop/cop/style/guard_clause_spec.rb
  132. +103 −81 spec/rubocop/cop/style/identical_conditional_branches_spec.rb
  133. +79 −61 spec/rubocop/cop/style/if_inside_else_spec.rb
  134. +17 −11 spec/rubocop/cop/style/if_unless_modifier_of_if_unless_spec.rb
  135. +142 −101 spec/rubocop/cop/style/if_unless_modifier_spec.rb
  136. +4 −2 spec/rubocop/cop/style/if_with_semicolon_spec.rb
  137. +221 −178 spec/rubocop/cop/style/indent_array_spec.rb
  138. +46 −24 spec/rubocop/cop/style/indent_assignment_spec.rb
  139. +239 −194 spec/rubocop/cop/style/indent_hash_spec.rb
  140. +400 −349 spec/rubocop/cop/style/indentation_consistency_spec.rb
  141. +700 −604 spec/rubocop/cop/style/indentation_width_spec.rb
  142. +62 −41 spec/rubocop/cop/style/infinite_loop_spec.rb
  143. +32 −16 spec/rubocop/cop/style/initial_indentation_spec.rb
  144. +54 −38 spec/rubocop/cop/style/inverse_methods_spec.rb
  145. +8 −6 spec/rubocop/cop/style/lambda_call_spec.rb
  146. +170 −102 spec/rubocop/cop/style/lambda_spec.rb
  147. +18 −12 spec/rubocop/cop/style/leading_comment_space_spec.rb
  148. +10 −10 spec/rubocop/cop/style/method_call_with_args_parentheses_spec.rb
  149. +18 −12 spec/rubocop/cop/style/method_call_without_args_parentheses_spec.rb
  150. +22 −14 spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb
  151. +78 −40 spec/rubocop/cop/style/method_def_parentheses_spec.rb
  152. +42 −36 spec/rubocop/cop/style/method_missing_spec.rb
  153. +96 −64 spec/rubocop/cop/style/method_name_spec.rb
  154. +98 −81 spec/rubocop/cop/style/mixin_grouping_spec.rb
  155. +23 −19 spec/rubocop/cop/style/module_function_spec.rb
  156. +4 −2 spec/rubocop/cop/style/multiline_array_brace_layout_spec.rb
  157. +67 −36 spec/rubocop/cop/style/multiline_assignment_layout_spec.rb
  158. +42 −28 spec/rubocop/cop/style/multiline_block_chain_spec.rb
  159. +135 −95 spec/rubocop/cop/style/multiline_block_layout_spec.rb
  160. +4 −2 spec/rubocop/cop/style/multiline_hash_brace_layout_spec.rb
  161. +68 −48 spec/rubocop/cop/style/multiline_if_then_spec.rb
  162. +110 −85 spec/rubocop/cop/style/multiline_memoization_spec.rb
  163. +17 −9 spec/rubocop/cop/style/multiline_method_call_brace_layout_spec.rb
  164. +489 −382 spec/rubocop/cop/style/multiline_method_call_indentation_spec.rb
  165. +13 −7 spec/rubocop/cop/style/multiline_method_definition_brace_layout_spec.rb
  166. +313 −251 spec/rubocop/cop/style/multiline_operation_indentation_spec.rb
  167. +13 −7 spec/rubocop/cop/style/multiline_ternary_operator_spec.rb
  168. +86 −73 spec/rubocop/cop/style/negated_if_spec.rb
  169. +49 −38 spec/rubocop/cop/style/negated_while_spec.rb
  170. +7 −5 spec/rubocop/cop/style/nested_ternary_operator_spec.rb
  171. +314 −228 spec/rubocop/cop/style/next_spec.rb
  172. +22 −14 spec/rubocop/cop/style/non_nil_check_spec.rb
  173. +33 −15 spec/rubocop/cop/style/numeric_literal_prefix_spec.rb
  174. +25 −13 spec/rubocop/cop/style/numeric_literals_spec.rb
  175. +41 −33 spec/rubocop/cop/style/op_method_spec.rb
  176. +22 −22 spec/rubocop/cop/style/option_hash_spec.rb
  177. +48 −24 spec/rubocop/cop/style/optional_arguments_spec.rb
  178. +360 −236 spec/rubocop/cop/style/parallel_assignment_spec.rb
  179. +99 −78 spec/rubocop/cop/style/parentheses_around_condition_spec.rb
  180. +54 −43 spec/rubocop/cop/style/percent_literal_delimiters_spec.rb
  181. +25 −15 spec/rubocop/cop/style/predicate_name_spec.rb
  182. +42 −30 spec/rubocop/cop/style/raise_args_spec.rb
  183. +84 −66 spec/rubocop/cop/style/redundant_begin_spec.rb
  184. +12 −8 spec/rubocop/cop/style/redundant_parentheses_spec.rb
  185. +211 −146 spec/rubocop/cop/style/redundant_return_spec.rb
  186. +97 −75 spec/rubocop/cop/style/redundant_self_spec.rb
  187. +56 −40 spec/rubocop/cop/style/rescue_ensure_alignment_spec.rb
  188. +136 −107 spec/rubocop/cop/style/rescue_modifier_spec.rb
  189. +140 −92 spec/rubocop/cop/style/safe_navigation_spec.rb
  190. +36 −29 spec/rubocop/cop/style/semicolon_spec.rb
  191. +218 −184 spec/rubocop/cop/style/signal_exception_spec.rb
  192. +44 −38 spec/rubocop/cop/style/single_line_block_params_spec.rb
  193. +24 −15 spec/rubocop/cop/style/single_line_methods_spec.rb
  194. +17 −9 spec/rubocop/cop/style/space_after_colon_spec.rb
  195. +46 −36 spec/rubocop/cop/style/space_after_method_name_spec.rb
  196. +10 −6 spec/rubocop/cop/style/space_around_block_parameters_spec.rb
  197. +52 −25 spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb
  198. +226 −145 spec/rubocop/cop/style/space_around_operators_spec.rb
  199. +13 −9 spec/rubocop/cop/style/space_before_block_braces_spec.rb
  200. +5 −3 spec/rubocop/cop/style/space_before_comment_spec.rb
  201. +46 −26 spec/rubocop/cop/style/space_before_first_arg_spec.rb
  202. +12 −8 spec/rubocop/cop/style/space_in_lambda_literal_spec.rb
  203. +20 −14 spec/rubocop/cop/style/space_inside_array_percent_literal_spec.rb
  204. +37 −21 spec/rubocop/cop/style/space_inside_block_braces_spec.rb
  205. +46 −28 spec/rubocop/cop/style/space_inside_brackets_spec.rb
  206. +72 −48 spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb
  207. +24 −13 spec/rubocop/cop/style/space_inside_parens_spec.rb
  208. +20 −14 spec/rubocop/cop/style/space_inside_percent_literal_delimiters_spec.rb
  209. +18 −12 spec/rubocop/cop/style/space_inside_range_literal_spec.rb
  210. +16 −12 spec/rubocop/cop/style/struct_inheritance_spec.rb
  211. +12 −8 spec/rubocop/cop/style/symbol_proc_spec.rb
  212. +5 −3 spec/rubocop/cop/style/tab_spec.rb
  213. +182 −124 spec/rubocop/cop/style/trailing_comma_in_arguments_spec.rb
  214. +280 −186 spec/rubocop/cop/style/trailing_comma_in_literal_spec.rb
  215. +251 −200 spec/rubocop/cop/style/trivial_accessors_spec.rb
  216. +45 −35 spec/rubocop/cop/style/unless_else_spec.rb
  217. +18 −16 spec/rubocop/cop/style/unneeded_capital_w_spec.rb
  218. +8 −4 spec/rubocop/cop/style/variable_name_spec.rb
  219. +35 −23 spec/rubocop/cop/style/when_then_spec.rb
  220. +32 −16 spec/rubocop/cop/style/while_until_do_spec.rb
  221. +16 −11 spec/rubocop/cop/style/while_until_modifier_spec.rb
  222. +31 −25 spec/rubocop/cop/style/word_array_spec.rb
  223. +10 −11 spec/rubocop/formatter/base_formatter_spec.rb
  224. +24 −19 spec/rubocop/formatter/clang_style_formatter_spec.rb
  225. +10 −9 spec/rubocop/formatter/disabled_config_formatter_spec.rb
  226. +7 −6 spec/rubocop/formatter/disabled_lines_formatter_spec.rb
  227. +4 −3 spec/rubocop/formatter/emacs_style_formatter_spec.rb
  228. +9 −8 spec/rubocop/formatter/offense_count_formatter_spec.rb
  229. +13 −13 spec/rubocop/formatter/progress_formatter_spec.rb
  230. +24 −30 spec/rubocop/formatter/simple_text_formatter_spec.rb
  231. +9 −8 spec/rubocop/formatter/worst_offenders_formatter_spec.rb
  232. +2 −2 spec/rubocop/options_spec.rb
  233. +12 −7 spec/rubocop/rake_task_spec.rb
  234. +4 −2 spec/rubocop/result_cache_spec.rb
  235. +4 −2 spec/rubocop/runner_spec.rb
  236. +12 −12 spec/rubocop/target_finder_spec.rb
  237. +262 −209 spec/support/empty_lines_around_body_shared_examples.rb
  238. +26 −19 spec/support/statement_modifier_helper.rb
@@ -18,8 +18,10 @@
'#' * 85,
'y ',
'puts x'])
create_file('.rubocop_todo.yml', ['Metrics/LineLength:',
' Enabled: false'])
create_file('.rubocop_todo.yml', <<-END.strip_indent)
Metrics/LineLength:
Enabled: false
END
create_file('.rubocop.yml', ['inherit_from: .rubocop_todo.yml'])
expect(cli.run(['--auto-gen-config'])).to eq(1)
expect(IO.readlines('.rubocop_todo.yml')[8..-1].map(&:chomp))
@@ -85,14 +87,16 @@
'#' * 85,
'y ',
'puts x'])
create_file('example2.rb', ['# encoding: utf-8',
'',
"\tx = 0",
'puts x',
'',
'class A',
' def a; end',
'end'])
create_file('example2.rb', <<-END.strip_indent)
# encoding: utf-8
\tx = 0
puts x
class A
def a; end
end
END
# Make ConfigLoader reload the default configuration so that its
# absolute Exclude paths will point into this example's work directory.
RuboCop::ConfigLoader.default_configuration = nil
@@ -267,14 +271,18 @@
end
it 'does not generate configuration for the Syntax cop' do
create_file('example1.rb', ['# encoding: utf-8',
'',
'x = < ', # Syntax error
'puts x'])
create_file('example2.rb', ['# encoding: utf-8',
'',
"\tx = 0",
'puts x'])
create_file('example1.rb', <<-END.strip_indent)
# encoding: utf-8
x = < # Syntax error
puts x
END
create_file('example2.rb', <<-END.strip_indent)
# encoding: utf-8
\tx = 0
puts x
END
expect(cli.run(['--auto-gen-config'])).to eq(1)
expect($stderr.string).to eq('')
expected =
@@ -367,14 +375,16 @@
'#' * 85,
'y ',
'puts x'])
create_file('example2.rb', ['# encoding: utf-8',
'',
"\tx = 0",
'puts x',
'',
'class A',
' def a; end',
'end'])
create_file('example2.rb', <<-END.strip_indent)
# encoding: utf-8
\tx = 0
puts x
class A
def a; end
end
END
# Make ConfigLoader reload the default configuration so that its
# absolute Exclude paths will point into this example's work directory.
RuboCop::ConfigLoader.default_configuration = nil
@@ -466,29 +476,31 @@
it 'disables cop if --exclude-limit is exceeded' do
expect(cli.run(['--auto-gen-config', '--exclude-limit', '1'])).to eq(1)
expect(IO.readlines('.rubocop_todo.yml')[8..-1].join)
.to eq(['# Offense count: 2',
'# Cop supports --auto-correct.',
'# Configuration parameters: EnforcedStyle, SupportedStyles.',
'# SupportedStyles: use_perl_names, use_english_names',
'Style/SpecialGlobalVars:',
' Enabled: false',
''].join("\n"))
.to eq(<<-END.strip_indent)
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
Enabled: false
END
end
it 'generates Exclude list if --exclude-limit is not exceeded' do
create_file('example4.rb', ['$!'])
expect(cli.run(['--auto-gen-config', '--exclude-limit', '10'])).to eq(1)
expect(IO.readlines('.rubocop_todo.yml')[8..-1].join)
.to eq(['# Offense count: 3',
'# Cop supports --auto-correct.',
'# Configuration parameters: EnforcedStyle, SupportedStyles.',
'# SupportedStyles: use_perl_names, use_english_names',
'Style/SpecialGlobalVars:',
' Exclude:',
" - 'example1.rb'",
" - 'example2.rb'",
" - 'example4.rb'",
''].join("\n"))
.to eq(<<-END.strip_indent)
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
Exclude:
- 'example1.rb'
- 'example2.rb'
- 'example4.rb'
END
end
end
Oops, something went wrong.

0 comments on commit 3c71da3

Please sign in to comment.