Sha256: 6af8465215d18a70f0adca0ba834cabe8abde52c795ac7f0903be80deb4f5193

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

describe 'nil object' do
  context 'local variable' do
    it 'should return nil conditional if var is nil' do
      var = nil
      expect(__var{}).to be_a(NilConditional)
    end
  end

  context 'test method' do
    before do
      allow(::Object).to receive(:nil_test) { nil }
    end

    it 'should return NilConditional instance when method return nil' do
      expect(Object.nil_test).to be nil
      expect(Object.new.__nil_test?).to be_a(NilConditional)
    end

    it 'should return NilConditional instance when method return nil and uses block' do
      expect(Object.new.__nil_test?{}).to be_a(NilConditional)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nil_conditional-1.0.0 spec/nil_spec.rb