source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb
Ruby
mit
12,856
master
19,459
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineOperationIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/MultilineOperationIndentation'] .merge(cop_config) .merge('IndentationWidth' => cop_ind...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_hash_key_line_breaks_spec.rb
Ruby
mit
12,856
master
3,636
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineHashKeyLineBreaks, :config do context 'with line break after opening bracket' do context 'when on different lines than brackets but keys on one' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) { ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/assignment_indentation_spec.rb
Ruby
mit
12,856
master
2,814
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::AssignmentIndentation, :config do let(:config) do RuboCop::Config.new('Layout/AssignmentIndentation' => { 'IndentationWidth' => cop_indent }, 'Layout/IndentationWidth' => {...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_array_element_line_break_spec.rb
Ruby
mit
12,856
master
4,327
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArrayElementLineBreak, :config do context 'elements listed on the first line' do it 'registers and corrects the offense' do expect_offense(<<~RUBY) a = [:a, ^^ Add a line break before the first element of a multi-l...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_class_body_spec.rb
Ruby
mit
12,856
master
9,706
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundClassBody, :config do let(:extra_begin) { 'Extra empty line detected at class body beginning.' } let(:extra_end) { 'Extra empty line detected at class body end.' } let(:missing_begin) { 'Empty line missing at class body beginning....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/trailing_whitespace_spec.rb
Ruby
mit
12,856
master
6,642
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::TrailingWhitespace, :config do let(:cop_config) { { 'AllowInHeredoc' => false } } it 'registers an offense for a line ending with space' do expect_offense(<<~RUBY) x = 0#{trailing_whitespace} ^ Trailing whitespace detected. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/initial_indentation_spec.rb
Ruby
mit
12,856
master
1,693
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::InitialIndentation, :config do it 'registers an offense for indented method definition' do expect_offense(<<-RUBY.strip_margin('|')) | def f | ^^^ Indentation of first line in file detected. | end RUBY expect_correction(<<...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/extra_spacing_spec.rb
Ruby
mit
12,856
master
24,512
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ExtraSpacing, :config do shared_examples 'common behavior' do it 'registers an offense and corrects alignment with token not preceded by space' do # The = and the ( are on the same column, but this is not for alignment, # it's just a ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_module_body_spec.rb
Ruby
mit
12,856
master
7,205
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundModuleBody, :config do let(:extra_begin) { 'Extra empty line detected at module body beginning.' } let(:extra_end) { 'Extra empty line detected at module body end.' } let(:missing_begin) { 'Empty line missing at module body beginn...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/hash_alignment_spec.rb
Ruby
mit
12,856
master
42,652
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::HashAlignment, :config do let(:config) do RuboCop::Config.new( 'Layout/HashAlignment' => default_cop_config.merge(cop_config), 'Layout/ArgumentAlignment' => argument_alignment_config ) end let(:default_cop_config) { { 'Enforc...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_parameter_indentation_spec.rb
Ruby
mit
12,856
master
8,181
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstParameterIndentation, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[consistent align_parentheses] } RuboCop::Config.new('Layout/FirstParameterIndentation' => cop_config.merge(supported_st...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_before_block_braces_spec.rb
Ruby
mit
12,856
master
6,450
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeBlockBraces, :config do let(:cop_config) { { 'EnforcedStyle' => 'space' } } context 'when EnforcedStyle is space' do it 'accepts braces surrounded by spaces' do expect_no_offenses('each { puts }') end it 'registers an...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/class_structure_spec.rb
Ruby
mit
12,856
master
13,815
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClassStructure, :config do let(:config) do RuboCop::Config.new( 'Layout/ClassStructure' => { 'ExpectedOrder' => %w[ module_inclusion constants attribute_macros delegate macros ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_around_equals_in_parameter_default_spec.rb
Ruby
mit
12,856
master
4,052
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundEqualsInParameterDefault, :config do context 'when EnforcedStyle is space' do let(:cop_config) { { 'EnforcedStyle' => 'space' } } it 'registers an offense and corrects default value assignment without space' do expect_offens...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_argument_indentation_spec.rb
Ruby
mit
12,856
master
36,421
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArgumentIndentation, :config do let(:cop_config) { { 'EnforcedStyle' => style } } let(:other_cops) { { 'Layout/IndentationWidth' => { 'Width' => indentation_width } } } shared_examples 'common behavior' do context 'when IndentationWidt...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_line_after_multiline_condition_spec.rb
Ruby
mit
12,856
master
6,584
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterMultilineCondition, :config do it 'registers an offense when no new line after `if` with multiline condition' do expect_offense(<<~RUBY) if multiline && ^^^^^^^^^^^^ Use empty line after multiline condition. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_begin_body_spec.rb
Ruby
mit
12,856
master
3,804
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundBeginBody, :config do shared_examples 'accepts' do |name, code| it "accepts #{name}" do expect_no_offenses(code) end end it 'registers an offense for begin body starting with a blank' do expect_offense(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/closing_heredoc_indentation_spec.rb
Ruby
mit
12,856
master
3,221
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClosingHeredocIndentation, :config do let(:config) { RuboCop::Config.new('Layout/ClosingHeredocIndentation' => cop_config) } let(:cop_config) { { 'Enabled' => true } } it 'accepts correctly indented closing heredoc' do expect_no_offenses(<<~...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_in_lambda_literal_spec.rb
Ruby
mit
12,856
master
4,398
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInLambdaLiteral, :config do context 'when configured to enforce spaces' do let(:cop_config) { { 'EnforcedStyle' => 'require_space' } } it 'registers an offense and corrects no space between -> and (' do expect_offense(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_inside_array_percent_literal_spec.rb
Ruby
mit
12,856
master
2,376
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideArrayPercentLiteral, :config do %w[i I w W].each do |type| [%w[{ }], %w[( )], %w([ ]), %w[! !]].each do |(ldelim, rdelim)| context "for #{type} type and #{[ldelim, rdelim]} delimiters" do define_method(:code_example) { |c...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_array_brace_layout_spec.rb
Ruby
mit
12,856
master
1,716
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineArrayBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit arrays' do expect_no_offenses(<<~RUBY) foo = a, b RUBY end it 'ignores single-line arrays' do expect_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/single_line_block_chain_spec.rb
Ruby
mit
12,856
master
2,923
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SingleLineBlockChain, :config do it 'registers an offense for method call chained on the same line as a block' do expect_offense(<<~RUBY) example.select { |item| item.cond? }.join('-') ^^^^^ Put met...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/closing_parenthesis_indentation_spec.rb
Ruby
mit
12,856
master
12,422
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClosingParenthesisIndentation, :config do context 'for method calls' do context 'with line break before 1st parameter' do it 'registers an offense for misaligned )' do expect_offense(<<~RUBY) some_method( a ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_hash_brace_layout_spec.rb
Ruby
mit
12,856
master
1,316
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineHashBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit hashes' do expect_no_offenses(<<~RUBY) foo(a: 1, b: 2) RUBY end it 'ignores single-line hashes' do exp...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb
Ruby
mit
12,856
master
3,765
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstMethodArgumentLineBreak, :config do context 'args listed on the first line' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) foo(bar, ^^^ Add a line break before the first argument of a multi-lin...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb
Ruby
mit
12,856
master
68,898
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodCallIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/MultilineMethodCallIndentation'] .merge(cop_config) .merge('IndentationWidth' => cop_i...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_hash_element_line_break_spec.rb
Ruby
mit
12,856
master
3,009
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstHashElementLineBreak, :config do it 'registers an offense and corrects elements listed on the first line' do expect_offense(<<~RUBY) a = { a: 1, ^^^^ Add a line break before the first element of a multi-line hash. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_assignment_layout_spec.rb
Ruby
mit
12,856
master
11,809
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineAssignmentLayout, :config do let(:supported_types) { %w[if] } let(:cop_config) { { 'EnforcedStyle' => enforced_style, 'SupportedTypes' => supported_types } } context 'new_line style' do let(:enforced_style) { 'new_line' } it '...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_block_body_spec.rb
Ruby
mit
12,856
master
3,742
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundBlockBody, :config do let(:beginning_offense_annotation) { '^{} Extra empty line detected at block body beginning.' } # Test blocks using both {} and do..end [%w[{ }], %w[do end]].each do |open, close| context "when EnforcedS...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/trailing_empty_lines_spec.rb
Ruby
mit
12,856
master
4,071
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::TrailingEmptyLines, :config do context 'when EnforcedStyle is final_newline' do let(:cop_config) { { 'EnforcedStyle' => 'final_newline' } } it 'accepts final newline' do expect_no_offenses("x = 0\n") end it 'accepts an empty f...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/dot_position_spec.rb
Ruby
mit
12,856
master
16,199
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::DotPosition, :config do context 'Leading dots style' do let(:cop_config) { { 'EnforcedStyle' => 'leading' } } it 'registers an offense for trailing dot in multi-line call' do expect_offense(<<~RUBY) something. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_before_comment_spec.rb
Ruby
mit
12,856
master
1,010
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeComment, :config do it 'registers an offense and corrects missing space before an EOL comment' do expect_offense(<<~RUBY) a += 1# increment ^^^^^^^^^^^ Put a space before an end-of-line comment. RUBY expect_c...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/array_alignment_spec.rb
Ruby
mit
12,856
master
9,214
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ArrayAlignment, :config do let(:config) do RuboCop::Config.new('Layout/ArrayAlignment' => cop_config, 'Layout/IndentationWidth' => { 'Width' => indentation_width }) end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/rescue_ensure_alignment_spec.rb
Ruby
mit
12,856
master
31,137
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::RescueEnsureAlignment, :config do it 'accepts the modifier form' do expect_no_offenses('test rescue nil') end context 'rescue with begin' do it 'registers an offense' do expect_offense(<<~RUBY) begin something ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_method_body_spec.rb
Ruby
mit
12,856
master
4,366
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundMethodBody, :config do let(:beginning_offense_annotation) { '^{} Extra empty line detected at method body beginning.' } let(:end_offense_annotation) { '^{} Extra empty line detected at method body end.' } it 'registers an offense...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_before_first_arg_spec.rb
Ruby
mit
12,856
master
4,366
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeFirstArg, :config do let(:cop_config) { { 'AllowForAlignment' => true } } let(:message) { 'Put one space between the method name and the first argument.' } context 'for method calls without parentheses' do it 'registers an offense...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/end_of_line_spec.rb
Ruby
mit
12,856
master
4,337
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EndOfLine, :config do include EncodingHelper shared_examples 'all configurations' do it 'accepts an empty file' do expect_no_offenses('') end end shared_examples 'iso-8859-15' do |eol| it 'can inspect non-UTF-8 encoded sourc...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/indentation_width_spec.rb
Ruby
mit
12,856
master
61,178
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::IndentationWidth, :config do let(:config) do RuboCop::Config.new( 'Layout/IndentationWidth' => cop_config, 'Layout/AccessModifierIndentation' => access_modifier_config, 'Layout/IndentationConsistency' => consistency_config, ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_array_line_breaks_spec.rb
Ruby
mit
12,856
master
2,037
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineArrayLineBreaks, :config do context 'when on same line' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) [1,2,3] RUBY end end context 'when on same line, separate line from brackets' do it...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_after_comma_spec.rb
Ruby
mit
12,856
master
2,348
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterComma, :config do let(:config) { RuboCop::Config.new('Layout/SpaceInsideHashLiteralBraces' => brace_config) } let(:brace_config) { {} } shared_examples 'ends with an item' do |items, annotation_start, correct_items| it 'registers a...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_after_colon_spec.rb
Ruby
mit
12,856
master
1,773
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterColon, :config do it 'registers an offense and corrects colon without space after it' do expect_offense(<<~RUBY) {a:3} ^ Space missing after colon. RUBY expect_correction(<<~RUBY) {a: 3} RUBY end it...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/redundant_line_break_spec.rb
Ruby
mit
12,856
master
24,042
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::RedundantLineBreak, :config do let(:config) do RuboCop::Config.new('Layout/LineLength' => { 'Enabled' => line_length_enabled, 'Max' => max_line_length }, 'Layout/RedundantL...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_array_element_indentation_spec.rb
Ruby
mit
12,856
master
18,681
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArrayElementIndentation, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[special_inside_parentheses consistent align_brackets] } RuboCop::Config.new('Layout/FirstArrayElemen...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb
Ruby
mit
12,856
master
10,695
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineEndStringConcatenationIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/LineEndStringConcatenationIndentation'] .merge(cop_config) .merge('Enabled' => ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_inside_range_literal_spec.rb
Ruby
mit
12,856
master
1,444
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideRangeLiteral, :config do it 'registers an offense for space inside .. literal' do expect_offense(<<~RUBY) 1 .. 2 ^^^^^^ Space inside range literal. 1.. 2 ^^^^^ Space inside range literal. 1 ..2 ^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_inside_percent_literal_delimiters_spec.rb
Ruby
mit
12,856
master
3,718
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsidePercentLiteralDelimiters, :config do let(:message) { 'Do not use spaces inside percent literal delimiters.' } %w[i I w W x].each do |type| [%w[{ }], %w[( )], %w([ ]), %w[! !]].each do |(ldelim, rdelim)| context "for #{type} ty...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_around_operators_spec.rb
Ruby
mit
12,856
master
33,024
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundOperators, :config do let(:config) do RuboCop::Config .new( 'AllCops' => { 'TargetRubyVersion' => target_ruby_version }, 'Layout/HashAlignment' => { 'EnforcedHashRocketStyle' => hash_style }, 'Layout/Space...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_spec.rb
Ruby
mit
12,856
master
956
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLines, :config do it 'registers an offense for consecutive empty lines' do expect_offense(<<~RUBY) test = 5 ^{} Extra blank line detected. top RUBY expect_correction(<<~RUBY) test = 5 top RUBY ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_inside_array_literal_brackets_spec.rb
Ruby
mit
12,856
master
23,910
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideArrayLiteralBrackets, :config do let(:no_space_in_empty_message) { 'Do not use space inside empty array brackets.' } let(:no_space_message) { 'Do not use space inside array brackets.' } let(:one_space_message) { 'Use one space inside e...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_comment_spec.rb
Ruby
mit
12,856
master
4,399
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyComment, :config do let(:cop_config) { { 'AllowBorderComment' => true, 'AllowMarginComment' => true } } it 'registers an offense and corrects using single line empty comment' do expect_offense(<<~RUBY) # ^ Source code comment ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/line_continuation_leading_space_spec.rb
Ruby
mit
12,856
master
10,554
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineContinuationLeadingSpace, :config do context 'EnforcedStyle: trailing' do let(:cop_config) { { 'EnforcedStyle' => 'trailing' } } it 'registers an offense when 2nd line has one leading space' do expect_offense(<<~'RUBY') 'th...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_arguments_spec.rb
Ruby
mit
12,856
master
6,412
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundArguments, :config do let(:empty_line_annotation) { '^{} Empty line detected around arguments.' } context 'when extra lines' do it 'registers and autocorrects offense for empty line before arg' do expect_offense(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/first_method_parameter_line_break_spec.rb
Ruby
mit
12,856
master
3,384
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstMethodParameterLineBreak, :config do it 'registers an offense and corrects params listed on the first line' do expect_offense(<<~RUBY) def foo(bar, ^^^ Add a line break before the first parameter of a multi-line method pa...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_method_call_brace_layout_spec.rb
Ruby
mit
12,856
master
4,586
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodCallBraceLayout, :config do let(:enforced_style) { 'symmetrical' } let(:cop_config) { { 'EnforcedStyle' => enforced_style } } it 'ignores implicit calls' do expect_no_offenses(<<~RUBY) foo 1, 2 RUBY end it...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_around_keyword_spec.rb
Ruby
mit
12,856
master
12,246
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundKeyword, :config do shared_examples 'missing before' do |highlight, expr, correct| it "registers an offense for missing space before keyword in `#{expr}`" do h_index = expr.index(highlight) expect_offense(<<~RUBY) #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/line_continuation_spacing_spec.rb
Ruby
mit
12,856
master
6,893
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineContinuationSpacing, :config do context 'EnforcedStyle: space' do let(:cop_config) { { 'EnforcedStyle' => 'space' } } it 'registers an offense when no space in front of backslash' do expect_offense(<<~'RUBY') if 2 + 2\ ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/begin_end_alignment_spec.rb
Ruby
mit
12,856
master
988
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::BeginEndAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'begin' } } it_behaves_like 'aligned', 'begin', '', 'end' it_behaves_like 'misaligned', <<~RUBY, false begin end ^^^ `end` at 2, 2 is not aligned wit...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_inside_string_interpolation_spec.rb
Ruby
mit
12,856
master
5,097
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideStringInterpolation, :config do context 'when EnforcedStyle is no_space' do let(:cop_config) { { 'EnforcedStyle' => 'no_space' } } context 'for ill-formatted string interpolations' do it 'registers offenses and autocorrects'...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_attribute_accessor_spec.rb
Ruby
mit
12,856
master
7,192
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundAttributeAccessor, :config do it 'registers an offense and corrects for code that immediately follows accessor' do expect_offense(<<~RUBY) attr_accessor :foo ^^^^^^^^^^^^^^^^^^ Add an empty line after attribute accesso...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_around_block_parameters_spec.rb
Ruby
mit
12,856
master
12,141
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundBlockParameters, :config do shared_examples 'common behavior' do it 'accepts an empty block' do expect_no_offenses('{}.each {}') end it 'skips lambda without args' do expect_no_offenses('->() { puts "a" }') end...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/heredoc_argument_closing_parenthesis_spec.rb
Ruby
mit
12,856
master
18,157
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::HeredocArgumentClosingParenthesis, :config do shared_examples 'correct cases' do |dot| context 'correct cases' do it 'accepts simple correct case' do expect_no_offenses(<<~RUBY) foo#{dot}bar(<<-SQL) foo ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_block_layout_spec.rb
Ruby
mit
12,856
master
10,257
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineBlockLayout, :config do it 'registers an offense for missing newline in do/end block w/o params' do expect_offense(<<~RUBY) test do foo ^^^ Block body expression is on the same line as the block start. end R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_before_comma_spec.rb
Ruby
mit
12,856
master
1,650
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeComma, :config do it 'registers an offense and corrects block argument with space before comma' do expect_offense(<<~RUBY) each { |s , t| } ^ Space found before comma. RUBY expect_correction(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/line_length_spec.rb
Ruby
mit
12,856
master
86,929
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineLength, :config do include_context 'with exclude limit tracking' let(:cop_config) { { 'Max' => 80, 'AllowedPatterns' => nil } } let(:config) do RuboCop::Config.new( 'Layout/LineLength' => { 'URISchemes' => %w[http https] }.merge(c...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/multiline_method_definition_brace_layout_spec.rb
Ruby
mit
12,856
master
723
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit defs' do expect_no_offenses(<<~RUBY) def foo a: 1, b: 2 end RUBY end it 'ignores single-...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_line_after_magic_comment_spec.rb
Ruby
mit
12,856
master
4,961
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterMagicComment, :config do it 'registers an offense for code that immediately follows comment' do expect_offense(<<~RUBY) # frozen_string_literal: true class Foo; end ^ Add an empty line after magic comments. RUB...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/leading_empty_lines_spec.rb
Ruby
mit
12,856
master
2,687
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LeadingEmptyLines, :config do it 'allows an empty input' do expect_no_offenses('') end it 'allows blank lines without any comments or code' do expect_no_offenses("\n") end it 'accepts not having a blank line before a class' do e...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/end_alignment_spec.rb
Ruby
mit
12,856
master
30,364
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EndAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'keyword', 'AutoCorrect' => true } } it_behaves_like 'aligned', "\xef\xbb\xbfclass", 'Test', 'end' it_behaves_like 'aligned', 'class', 'Test', 'end' it_be...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_line_after_guard_clause_spec.rb
Ruby
mit
12,856
master
17,925
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterGuardClause, :config do it 'does not register an offense when the clause is not followed by other code' do expect_no_offenses(<<~RUBY) return unless item.positive? RUBY end it 'registers an offense and corrects a guar...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/space_after_semicolon_spec.rb
Ruby
mit
12,856
master
1,925
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterSemicolon, :config do let(:config) { RuboCop::Config.new('Layout/SpaceInsideBlockBraces' => brace_config) } let(:brace_config) { {} } it 'registers an offense and corrects semicolon without space after it' do expect_offense(<<~RUBY...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_line_between_defs_spec.rb
Ruby
mit
12,856
master
17,621
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineBetweenDefs, :config do let(:cop_config) { { 'AllowAdjacentOneLineDefs' => false } } it 'finds offenses in inner classes' do expect_offense(<<~RUBY) class K def m end class J def n en...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/block_alignment_spec.rb
Ruby
mit
12,856
master
26,606
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::BlockAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'either' } } context 'when the block has no arguments' do it 'registers an offense for mismatched block end' do expect_offense(<<~RUBY) test do ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/leading_comment_space_spec.rb
Ruby
mit
12,856
master
9,724
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LeadingCommentSpace, :config do it 'registers an offense and corrects comment without leading space' do expect_offense(<<~RUBY) #missing space ^^^^^^^^^^^^^^ Missing space after `#`. RUBY expect_correction(<<~RUBY) # mi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/indentation_consistency_spec.rb
Ruby
mit
12,856
master
18,252
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::IndentationConsistency, :config do let(:cop_config) { { 'EnforcedStyle' => 'normal' } } context 'with top-level code' do it 'accepts an empty expression string interpolation' do expect_no_offenses(<<~'RUBY') "#{}" RUBY ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/layout/empty_lines_around_exception_handling_keywords_spec.rb
Ruby
mit
12,856
master
7,558
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundExceptionHandlingKeywords, :config do let(:message) { '^{} Extra empty line detected' } shared_examples 'accepts' do |name, code| it "accepts #{name}" do expect_no_offenses(code) end end it 'registers an offense ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/generator/require_file_injector_spec.rb
Ruby
mit
12,856
master
6,671
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Generator::RequireFileInjector do let(:stdout) { StringIO.new } let(:root_file_path) { 'lib/root.rb' } let(:injector) do described_class.new(source_path: source_path, root_file_path: root_file_path, output: stdout) end around do |example| Di...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/require_mfa_spec.rb
Ruby
mit
12,856
master
5,962
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RequireMFA, :config do context 'when the gemspec is blank' do it 'does not register an offense' do expect_no_offenses('', 'my.gemspec') end end context 'when the specification is blank' do it 'registers an offense and corrects...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/dependency_version_spec.rb
Ruby
mit
12,856
master
30,967
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DependencyVersion, :config do let(:cop_config) do { 'Enabled' => true, 'EnforcedStyle' => enforced_style, 'AllowedGems' => allowed_gems } end let(:allowed_gems) { [] } let(:config) do base = RuboCop::ConfigLoader ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/ordered_dependencies_spec.rb
Ruby
mit
12,856
master
4,549
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::OrderedDependencies, :config do let(:cop_config) { { 'TreatCommentsAsGroupSeparators' => treat_comments_as_group_separators } } let(:treat_comments_as_group_separators) { false } shared_examples 'ordered dependency' do |add_dependency| cont...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/required_ruby_version_spec.rb
Ruby
mit
12,856
master
8,490
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RequiredRubyVersion, :config do # rubocop:disable RSpec/RepeatedExampleGroupDescription context 'target ruby version > 3.4', :ruby34 do # rubocop:enable RSpec/RepeatedExampleGroupDescription it 'registers an offense when `required_ruby_ver...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/ruby_version_globals_usage_spec.rb
Ruby
mit
12,856
master
1,231
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage, :config do it 'registers an offense when using `RUBY_VERSION`' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| RUBY_VERSION ^^^^^^^^^^^^ Do not use `RUBY_VERSION` in gemspec file. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/attribute_assignment_spec.rb
Ruby
mit
12,856
master
2,119
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::AttributeAssignment, :config do it 'does not register an offense when only indexed hash assignment is used' do expect_no_offenses(<<~RUBY) Gem::Specification.new do |spec| spec.metadata['key-0'] = 'value-0' spec.metadata['k...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/deprecated_attribute_assignment_spec.rb
Ruby
mit
12,856
master
3,351
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DeprecatedAttributeAssignment, :config do shared_examples 'deprecated attributes' do |attribute, value| it 'registers and corrects an offense when using `s.rubygems_version =`' do expect_offense(<<~RUBY) Gem::Specification.new do |...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/add_runtime_dependency_spec.rb
Ruby
mit
12,856
master
1,320
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::AddRuntimeDependency, :config do it 'registers an offense when using `add_runtime_dependency`' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| spec.add_runtime_dependency('rubocop') ^^^^^^^^^^^^^^^^^^^^^^ U...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/duplicated_assignment_spec.rb
Ruby
mit
12,856
master
5,385
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DuplicatedAssignment, :config do it 'registers an offense when using `name=` twice' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| spec.name = 'rubocop' spec.name = 'rubocop2' ^^^^^^^^^^^^^^^^^^^^^^ `na...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/gemspec/development_dependencies_spec.rb
Ruby
mit
12,856
master
3,313
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DevelopmentDependencies, :config do let(:cop_config) do { 'Enabled' => true, 'EnforcedStyle' => enforced_style, 'AllowedGems' => [ 'allowed' ] } end shared_examples 'prefer gem file' do it 'registers ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/float_out_of_range_spec.rb
Ruby
mit
12,856
master
832
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::FloatOutOfRange, :config do it 'does not register an offense for 0.0' do expect_no_offenses('0.0') end it 'does not register an offense for tiny little itty bitty floats' do expect_no_offenses('1.1e-100') end it 'does not register an ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/percent_symbol_array_spec.rb
Ruby
mit
12,856
master
2,203
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::PercentSymbolArray, :config do context 'detecting colons or commas in a %i/%I string' do %w[i I].each do |char| it 'accepts tokens without colons or commas' do expect_no_offenses("%#{char}(foo bar baz)") end it 'accepts l...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_hash_key_spec.rb
Ruby
mit
12,856
master
4,019
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateHashKey, :config do context 'when there is a duplicated key in the hash literal' do it 'registers an offense' do expect_offense(<<~RUBY) hash = { 'otherkey' => 'value', 'key' => 'value', 'key' => 'hi' } ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_string_coercion_spec.rb
Ruby
mit
12,856
master
5,467
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantStringCoercion, :config do it 'registers an offense and corrects `to_s` in interpolation' do expect_offense(<<~'RUBY') "this is the #{result.to_s}" ^^^^ Redundant use of `Object#to_s` in interpolation. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default_spec.rb
Ruby
mit
12,856
master
2,693
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::HashNewWithKeywordArgumentsAsDefault, :config do it 'registers an offense when using `Hash.new` with keyword arguments for default' do expect_offense(<<~RUBY) Hash.new(key: :value) ^^^^^^^^^^^ Use a hash literal instead of keyw...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/no_return_in_begin_end_blocks_spec.rb
Ruby
mit
12,856
master
3,565
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NoReturnInBeginEndBlocks, :config do shared_examples 'rejects return inside a block' do |operator| it "rejects a return statement inside a block when using #{operator} for local variable" do expect_offense(<<~RUBY) some_value = 10 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/implicit_string_concatenation_spec.rb
Ruby
mit
12,856
master
4,917
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ImplicitStringConcatenation, :config do context 'on a single string literal' do it 'does not register an offense' do expect_no_offenses('abc') end end context 'on adjacent string literals on the same line' do it 'registers an off...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unused_block_argument_spec.rb
Ruby
mit
12,856
master
15,102
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnusedBlockArgument, :config do let(:cop_config) { { 'AllowUnusedKeywordArguments' => false } } context 'inspection' do context 'when a block takes multiple arguments' do context 'and an argument is unused' do it 'registers an offe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/void_spec.rb
Ruby
mit
12,856
master
30,442
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::Void, :config do described_class::BINARY_OPERATORS.each do |op| it "registers an offense for void op #{op} if not on last line" do expect_offense(<<~RUBY, op: op) a %{op} b ^{op} Operator `#{op}` used in void context. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
Ruby
mit
12,856
master
11,877
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ShadowingOuterLocalVariable, :config do context 'when a block argument has same name as an outer scope variable' do it 'registers an offense' do expect_offense(<<~RUBY) def some_method foo = 1 puts foo 1....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/symbol_conversion_spec.rb
Ruby
mit
12,856
master
7,740
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SymbolConversion, :config do shared_examples 'offense' do |from, to| it "registers an offense for #{from}" do expect_offense(<<~RUBY, from: from) #{from} ^{from} Unnecessary symbol conversion; use `#{to}` instead. RUBY ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/literal_in_interpolation_spec.rb
Ruby
mit
12,856
master
18,598
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::LiteralInInterpolation, :config do it 'accepts empty interpolation' do expect_no_offenses('"this is #{a} silly"') end it 'accepts interpolation of xstr' do expect_no_offenses('"this is #{`a`} silly"') end it 'accepts interpolation of ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/shadowed_argument_spec.rb
Ruby
mit
12,856
master
22,508
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ShadowedArgument, :config do let(:cop_config) { { 'IgnoreImplicitReferences' => false } } describe 'method argument shadowing' do context 'when a single argument is shadowed' do it 'registers an offense' do expect_offense(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_rescue_exception_spec.rb
Ruby
mit
12,856
master
1,935
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateRescueException, :config do it 'registers an offense when duplicate exception exists' do expect_offense(<<~RUBY) begin something rescue FirstError rescue SecondError, FirstError ^^^^^^^^^...