Sha256: aa946963ce1a6854a9a36809cc02cef0e141ff4424a8ec7b32ee26949752e7c0

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

describe 'local variables' do
  context 'test variable' do
    it 'should raise error when using non existent test variable' do
      expect { test_variable }.to raise_error(NameError)
    end

    it 'should not raise error when using  __test_variable{}' do
      expect { __test_variable{} }.to_not raise_error
    end

    it 'should return NilConditional instance when using non existent var with preceding __ and trailing block' do
      expect(__test_variable{}).to be_a(NilConditional)
    end

    it 'should support chained methods with nil conditional' do
      expect { __test_variable{}.foo_?.bar_?.car_?.cow_? }.to_not raise_error
      expect(__test_variable{}.foo_?.bar_?.car_?.cow_?).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/local_variables_spec.rb