Commits

Steven! Ragnarök committed eea49ae

#bonk yields its callee to a given block.

Comments (0)

Files changed (2)

 module Bonk
   module Bonk::InstanceMethods
     def bonk
+      yield self
     end
   end
 

test/bonk_test.rb

 require "./lib/bonk"
 
 class BonkTest < MiniTest::Unit::TestCase
+  def setup
+    @object = Object.new
+  end
+
   def test_object_responds_to_bonk
-    assert_respond_to Object.new, :bonk
+    assert_respond_to @object, :bonk
+  end
+
+  def test_bonk_passes_in_its_callee
+    temp_obj = :didnt_run
+    @object.bonk do |obj|
+      temp_obj = obj
+    end
+
+    assert_equal @object, temp_obj
   end
 end