Sha256: 5a87eed3bccc5d599ec25f8cbf79ec192afc0f93503abaa191576aa3df821588

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

require "spec_helper"

module RuboCop
  module Cop
    module Style
      describe SubclassInitialization, :config do
        include RuboCop::RSpec::ExpectOffense

        before do
          cop_config['InitializeArrayWith'] = 'Grizzly::Collection'
        end

        it 'registers an offense when using instance_of(Array)' do
          expect_offense(<<~RUBY)
            MyModule::MyArray[1,2,3]
            ^^^^^^^^^^^^^^^^^^^^^^^^ instance_of should not be of Array
          RUBY

          expect_correction(<<~RUBY)
            Grizzly::Collection.new([1, 2, 3])
          RUBY
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grizzly-rb-1.1.0 conversion/spec/cops/subclass_initialization_spec.rb
grizzly-rb-1.0.0 conversion/spec/cops/subclass_initialization_spec.rb