Sha256: c42e2302a7393d2ca683b85ffe002dca00e807a230126433f4109ce36d66ce31

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require "spec_helper"

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

        before { cop_config['GrepSupportRubyVersion'] = '3.3' }

        it 'registers an offense for grep specs' do
          expect_offense(<<~RUBY)
            describe "Enumerable#grep" do
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #grep and grep_v cannot be implemented
              before :each do
                @a = EnumerableSpecs::EachDefiner.new( 2, 4, 6, 8, 10)
              end
            end
          RUBY

          expect_correction(<<~RUBY)
            ruby_bug '#11808', ''...'3.3' do
            describe "Enumerable#grep" do
              before :each do
                @a = EnumerableSpecs::EachDefiner.new( 2, 4, 6, 8, 10)
              end
            end
            end

          RUBY
        end

        it 'registers an offense for grep_v specs' do
          expect_offense(<<~RUBY)
            describe "Enumerable#grep_v" do
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #grep and grep_v cannot be implemented
              before :each do
                @a = EnumerableSpecs::EachDefiner.new( 2, 4, 6, 8, 10)
              end
            end
          RUBY

          expect_correction(<<~RUBY)
            ruby_bug '#11808', ''...'3.3' do
            describe "Enumerable#grep_v" do
              before :each do
                @a = EnumerableSpecs::EachDefiner.new( 2, 4, 6, 8, 10)
              end
            end
            end

          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/grep_implementation_spec.rb
grizzly-rb-1.0.0 conversion/spec/cops/grep_implementation_spec.rb