Sha256: 310925cc6611c46b71fb9b49386fed5b4ddc8517e18c2e83c1c71ca61acaf86f
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
describe Object do context 'test method' do it 'should raise error when receiving test_method' do expect { Object.new.test_method }.to raise_error(NoMethodError) end it 'should not raise error when receiving __test_method' do expect { Object.new.__test_method }.to_not raise_error end it 'should return NilConditional instance when received non existent method with preceding __' do expect(Object.new.__test_method).to be_a(NilConditional) end it 'should support chained methods with nil conditional' do expect { Object.new.__test_method.foo_?.bar_?.car_?.cow_? }.to_not raise_error expect(Object.new.__test_method.foo_?.bar_?.car_?.cow_?).to be_a(NilConditional) end it 'should support methods with arguments' do expect { Object.__test_method_with_args(1, 2, 3) }.to_not raise_error expect(Object.__test_method_with_args(1, 2, 3)).to be_a(NilConditional) end it 'should support methods with blocks' do expect(Object.__test_method_with_block{ a = 'b' }).to be_a(NilConditional) expect(['a', 'b'].__delete_if { |i| i == 'b' }).to eq([ 'a' ]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nil_conditional-1.0.0 | spec/object_spec.rb |