Skip to content

Commit

Permalink
Fix build error using RuboCop 1.49+
Browse files Browse the repository at this point in the history
Fixes rubocop/rubocop#11817.

The test code is updated with the following command to resolve the issue:

```console
$ bundle exec rubocop --require rubocop/cop/internal_affairs \
  --only InternalAffairs/RedundantDescribedClassAsSubject,Layout/EmptyLines -a spec
```
  • Loading branch information
koic authored and thomthom committed Apr 25, 2023
1 parent 884032d commit 679d2e2
Show file tree
Hide file tree
Showing 49 changed files with 44 additions and 165 deletions.
7 changes: 1 addition & 6 deletions spec/rubocop/cop/sketchup_bugs/material_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupBugs::MaterialName do
describe RuboCop::Cop::SketchupBugs::MaterialName, :config do

context 'when using material.name=' do

context 'affected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2016')
end
Expand Down Expand Up @@ -39,11 +37,8 @@

end # context


context 'unaffected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2018')
end
Expand Down
7 changes: 1 addition & 6 deletions spec/rubocop/cop/sketchup_bugs/render_mode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupBugs::RenderMode do
describe RuboCop::Cop::SketchupBugs::RenderMode, :config do

context 'affected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2018')
end
Expand Down Expand Up @@ -44,11 +42,8 @@

end # context


context 'unaffected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2014')
end
Expand Down
7 changes: 1 addition & 6 deletions spec/rubocop/cop/sketchup_bugs/uniform_scaling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupBugs::UniformScaling do
describe RuboCop::Cop::SketchupBugs::UniformScaling, :config do

context 'affected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2016')
end
Expand Down Expand Up @@ -44,11 +42,8 @@

end # context


context 'unaffected SketchUp versions' do

subject(:cop) { described_class.new(config) }

let(:config) do
sketchup_version_config('SketchUp 2018')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::AddSeparatorToMenu do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::AddSeparatorToMenu, :config do

it 'registers an offense for add_separator_to_menus' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::OperationNextTransparent do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::OperationNextTransparent, :config do

it 'registers an offense for start_operation third argument' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_deprecations/require_all_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::RequireAll do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::RequireAll, :config do

it 'registers an offense for require_all' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::SetTextureProjection do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::SetTextureProjection, :config do

it 'registers an offense for calling set_texture_projection' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::ShowRubyPanel do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::ShowRubyPanel, :config do

it 'registers an offense for show_ruby_panel' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_deprecations/sketchup_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupDeprecations::SketchupSet do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupDeprecations::SketchupSet, :config do

it 'registers an offense for Sketchup::Set.new' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_performance/openssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupPerformance::OpenSSL do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupPerformance::OpenSSL, :config do

it 'registers an offense for use of OpenSSL' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupPerformance::OperationDisableUI do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupPerformance::OperationDisableUI, :config do

it 'does not register an offense when starting an operation and disabling the UI' do
expect_no_offenses(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupPerformance::SelectionBulkChanges do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupPerformance::SelectionBulkChanges, :config do

it 'registers an offense for use of selection.add within each loop' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_performance/type_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupPerformance::TypeCheck do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupPerformance::TypeCheck, :config do

it 'registers an offense for type checking by string comparison using ==' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_performance/typename_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupPerformance::Typename do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupPerformance::Typename, :config do

it 'registers an offense for use of Sketchup::Entity#typename' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_requirements/api_namespace_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::ApiNamespace do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::ApiNamespace, :config do

described_class::NAMESPACES.each do |var|

Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_requirements/debug_mode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::DebugMode do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::DebugMode, :config do

it 'registers an offense when using `Sketchup#debug_mode`' do
expect_offense(<<~RUBY)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_requirements/exit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::Exit do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::Exit, :config do

it 'registers an offense for exit' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

describe RuboCop::Cop::SketchupRequirements::ExtensionNamespace, :config do

subject(:cop) { described_class.new(config) }

it 'registers an offense for multiple top level namespaces' do
expect_offense(<<~RUBY)
module Example
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_requirements/gem_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GemInstall do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GemInstall, :config do

it 'registers an offense for Gem.install' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GetExtensionLicense do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GetExtensionLicense, :config do

context 'string literal extension GUID' do

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GlobalConstants do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GlobalConstants, :config do

it 'registers an offense for global constants' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GlobalInclude do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GlobalInclude, :config do

it 'registers an offense for global include' do
expect_offense(<<~RUBY)
Expand All @@ -22,7 +20,6 @@ module Kernel
RUBY
end


it 'does not register an offense for include in namespaced module' do
expect_no_offenses(<<~RUBY)
module Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GlobalMethods do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GlobalMethods, :config do

it 'registers an offense for global methods' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::GlobalVariables do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::GlobalVariables, :config do

it 'registers an offense for $custom' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::InitializeEntity do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::InitializeEntity, :config do

RuboCop::Cop::SketchupRequirements::InitializeEntity::ENTITY_CLASSES.each do |keyword|
it "registers an offense when using `Sketchup::#{keyword}.new`" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::LanguageHandlerGlobals do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::LanguageHandlerGlobals, :config do

described_class::LH_GLOBALS.each do |var|

Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/sketchup_requirements/load_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::LoadPath do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::LoadPath, :config do

it 'registers an offense when setting $LOAD_PATH' do
expect_offense(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::MinimalRegistration do

subject(:cop) { described_class.new(config) }
describe RuboCop::Cop::SketchupRequirements::MinimalRegistration, :config do

# Based on file_name_spec.rb
let(:config) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::ObserversStartOperation do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::ObserversStartOperation, :config do

it 'does not register an offense for not starting an operation' do
expect_no_offenses(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::RegisterExtension do

subject(:cop) { described_class.new }
describe RuboCop::Cop::SketchupRequirements::RegisterExtension, :config do

it 'does not register an offense for extension set to load by default' do
expect_no_offenses(<<~RUBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

require 'spec_helper'

describe RuboCop::Cop::SketchupRequirements::RubyCoreNamespace do
describe RuboCop::Cop::SketchupRequirements::RubyCoreNamespace, :config do

namespace_types = %w[class module].freeze
mutators = %w[include extend].freeze

subject(:cop) { described_class.new }

described_class::NAMESPACES.each do |var|

# The namespace objects are either modules or classes, but we don't know
Expand Down

0 comments on commit 679d2e2

Please sign in to comment.