spec/object_spec.rb in darkhelmet-darkext-0.11.2 vs spec/object_spec.rb in darkhelmet-darkext-0.12.0
- old
+ new
@@ -11,6 +11,18 @@
end
it 'should return nil from try if called on nil' do
nil.try(1) { |a| }.should be_nil
end
+
+ it 'should try...like really try' do
+ nil.try { |me| me.foo }.should be_nil
+ true.try { |me| me }.should be_true
+ true.try(:nil?).should_not be_nil
+ end
+
+ it 'should tap dance' do
+ 10.tap { |m| m.should == 10 }.should == 10
+ o = Object.new
+ o.tap { |m| m.should == o }.should == o
+ end
end