Sha256: be4a37de10062a97a007fef1f8d15553bb8e732c6f108a0c2319488844f0e6a0

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe NilComparison do
        subject(:cop) { described_class.new }

        it 'registers an offence for == nil' do
          inspect_source(cop,
                         ['x == nil'])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for === nil' do
          inspect_source(cop,
                         ['x === nil'])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for === nil' do
          inspect_source(cop,
                         ['x != nil'])
          expect(cop.offences.size).to eq(1)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.13.0 spec/rubocop/cop/style/nil_comparison_spec.rb