Skip to content

Commit

Permalink
Remove unneeded let for specs using :config shared environment
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed May 21, 2020
1 parent 94b5542 commit 66bf72f
Show file tree
Hide file tree
Showing 163 changed files with 0 additions and 326 deletions.
2 changes: 0 additions & 2 deletions spec/rubocop/cop/bundler/duplicated_gem_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Bundler::DuplicatedGem, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'Include' => ['**/Gemfile'] } }

context 'when investigating Ruby files' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/bundler/gem_comment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Bundler::GemComment, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{
'Include' => ['**/Gemfile'],
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/bundler/ordered_gems_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Bundler::OrderedGems, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{
'TreatCommentsAsGroupSeparators' => treat_comments_as_group_separators,
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/gemspec/ordered_dependencies_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Gemspec::OrderedDependencies, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{
'TreatCommentsAsGroupSeparators' => treat_comments_as_group_separators,
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/gemspec/required_ruby_version_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Gemspec::RequiredRubyVersion, :config do
subject(:cop) { described_class.new(config) }

context 'target ruby version > 2.7', :ruby27 do
it 'registers an offense when `required_ruby_version` is lower than ' \
'`TargetRubyVersion`' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/gemspec/ruby_version_globals_usage_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage, :config do
subject(:cop) { described_class.new(config) }

it 'registers an offense when using `RUBY_VERSION`' do
expect_offense(<<~RUBY, '/path/to/foo.gemspec')
Gem::Specification.new do |spec|
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/assignment_indentation_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::AssignmentIndentation, :config do
subject(:cop) { described_class.new(config) }

let(:config) do
RuboCop::Config.new('Layout/AssignmentIndentation' => {
'IndentationWidth' => cop_indent
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/block_alignment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::BlockAlignment, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{ 'EnforcedStyleAlignWith' => 'either' }
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/class_structure_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::ClassStructure, :config do
subject(:cop) { described_class.new(config) }

let(:config) do
RuboCop::Config.new(
'Layout/ClassStructure' => {
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/def_end_alignment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::DefEndAlignment, :config do
subject(:cop) { described_class.new(config) }

let(:source) do
<<~RUBY
foo def a
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/dot_position_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::DotPosition, :config do
subject(:cop) { described_class.new(config) }

context 'Leading dots style' do
let(:cop_config) { { 'EnforcedStyle' => 'leading' } }

Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/empty_comment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyComment, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{ 'AllowBorderComment' => true, 'AllowMarginComment' => true }
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/empty_line_between_defs_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLineBetweenDefs, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'AllowAdjacentOneLineDefs' => false } }

it 'finds offenses in inner classes' do
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier, :config do
subject(:cop) { described_class.new(config) }

context 'EnforcedStyle is `around`' do
let(:cop_config) { { 'EnforcedStyle' => 'around' } }

Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/empty_lines_around_arguments_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundArguments, :config do
subject(:cop) { described_class.new(config) }

context 'when extra lines' do
it 'registers offense for empty line before arg' do
inspect_source(<<~RUBY)
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/empty_lines_around_block_body_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundBlockBody, :config do
subject(:cop) { described_class.new(config) }

# Test blocks using both {} and do..end
[%w[{ }], %w[do end]].each do |open, close|
context "when EnforcedStyle is no_empty_lines for #{open} #{close} block" do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/empty_lines_around_class_body_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundClassBody, :config do
subject(:cop) { described_class.new(config) }

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.' }
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundModuleBody, :config do
subject(:cop) { described_class.new(config) }

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 beginning.' }
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/end_alignment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EndAlignment, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{ 'EnforcedStyleAlignWith' => 'keyword', 'AutoCorrect' => true }
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/end_of_line_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::EndOfLine, :config do
subject(:cop) { described_class.new(config) }

shared_examples 'all configurations' do
it 'accepts an empty file' do
inspect_source_file('')
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/extra_spacing_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::ExtraSpacing, :config do
subject(:cop) { described_class.new(config) }

shared_examples 'common behavior' do
it 'registers an offense and corrects alignment with token ' \
'not preceded by space' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/first_argument_indentation_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::FirstArgumentIndentation, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{ 'EnforcedStyle' => style }
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/first_parameter_indentation_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::FirstParameterIndentation, :config do
subject(:cop) { described_class.new(config) }

let(:config) do
supported_styles = {
'SupportedStyles' => %w[consistent align_parentheses]
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/hash_alignment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::HashAlignment, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) do
{
'EnforcedHashRocketStyle' => 'key',
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/heredoc_indentation_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::HeredocIndentation, :config do
subject(:cop) { described_class.new(config) }

let(:allow_heredoc) { true }
let(:other_cops) do
{
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/indentation_consistency_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::IndentationConsistency, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'normal' } }

context 'with top-level code' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/leading_comment_space_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::LeadingCommentSpace, :config do
subject(:cop) { described_class.new(config) }

it 'registers an offense and corrects comment without leading space' do
expect_offense(<<~RUBY)
#missing space
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/leading_empty_lines_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::LeadingEmptyLines, :config do
subject(:cop) { described_class.new(config) }

it 'allows an empty input' do
expect_no_offenses('')
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/line_length_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::LineLength, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'Max' => 80, 'IgnoredPatterns' => nil } }

let(:config) do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/multiline_array_brace_layout_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::MultilineArrayBraceLayout, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } }

it 'ignores implicit arrays' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/multiline_assignment_layout_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::MultilineAssignmentLayout, :config do
subject(:cop) { described_class.new(config) }

let(:supported_types) { %w[if] }

let(:cop_config) do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/multiline_hash_brace_layout_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::MultilineHashBraceLayout, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } }

it 'ignores implicit hashes' do
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::MultilineMethodCallBraceLayout, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } }

it 'ignores implicit calls' do
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } }

it 'ignores implicit defs' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/rescue_ensure_alignment_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::RescueEnsureAlignment, :config do
subject(:cop) { described_class.new(config) }

it 'accepts the modifier form' do
expect_no_offenses('test rescue nil')
end
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/space_around_block_parameters_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceAroundBlockParameters, :config do
subject(:cop) { described_class.new(config) }

shared_examples 'common behavior' do
it 'accepts an empty block' do
expect_no_offenses('{}.each {}')
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceAroundEqualsInParameterDefault, :config do
subject(:cop) { described_class.new(config) }

context 'when EnforcedStyle is space' do
let(:cop_config) { { 'EnforcedStyle' => 'space' } }

Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/space_before_block_braces_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceBeforeBlockBraces, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'space' } }

context 'when EnforcedStyle is space' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/space_before_first_arg_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceBeforeFirstArg, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'AllowForAlignment' => true } }

context 'for method calls without parentheses' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/space_in_lambda_literal_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceInLambdaLiteral, :config do
subject(:cop) { described_class.new(config) }

context 'when configured to enforce spaces' do
let(:cop_config) { { 'EnforcedStyle' => 'require_space' } }

Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceInsideArrayLiteralBrackets, :config do
subject(:cop) { described_class.new(config) }

it 'does not register offense for any kind of reference brackets' do
expect_no_offenses(<<~RUBY)
a[1]
Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceInsideHashLiteralBraces, :config do
subject(:cop) { described_class.new(config) }

let(:cop_config) { { 'EnforcedStyle' => 'space' } }

context 'with space inside empty braces not allowed' do
Expand Down
2 changes: 0 additions & 2 deletions spec/rubocop/cop/layout/space_inside_parens_spec.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceInsideParens, :config do
subject(:cop) { described_class.new(config) }

context 'when EnforcedStyle is no_space' do
let(:cop_config) { { 'EnforcedStyle' => 'no_space' } }

Expand Down
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Layout::SpaceInsideReferenceBrackets, :config do
subject(:cop) { described_class.new(config) }

context 'with space inside empty brackets not allowed' do
let(:cop_config) { { 'EnforcedStyleForEmptyBrackets' => 'no_space' } }

Expand Down

0 comments on commit 66bf72f

Please sign in to comment.