Sha256: dd9b4686e34e49c06366538bee2f1eca0517e8e03fb4919c0f9a1c7d59cff904
Contents?: true
Size: 598 Bytes
Versions: 3
Compression:
Stored size: 598 Bytes
Contents
require File.expand_path('../spec_helper', File.dirname(__FILE__)) require 'gorillib/object/try' class Foo def i_am_a_method_hooray param='hooray' "i was called! #{param}!" end end describe Object do describe '#try' do it 'returns nil if item does not #respond_to? method' do Foo.new.try(:i_am_not_a_method).should be_nil end it 'calls the method (with args) if the item does #respond_to? it' do Foo.new.try(:i_am_a_method_hooray).should == "i was called! hooray!" Foo.new.try(:i_am_a_method_hooray, 'yay').should == "i was called! yay!" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gorillib-0.1.11 | spec/object/try_spec.rb |
gorillib-0.1.9 | spec/object/try_spec.rb |
gorillib-0.1.8 | spec/object/try_spec.rb |