test/tc_basic.rb in blockenspiel-0.4.5 vs test/tc_basic.rb in blockenspiel-0.5.0

- old
+ new

@@ -3,11 +3,11 @@ # Blockenspiel basic tests # # This file contains tests for the simple use cases. # # ----------------------------------------------------------------------------- -# Copyright 2008-2011 Daniel Azuma +# Copyright 2008 Daniel Azuma # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -34,18 +34,18 @@ # POSSIBILITY OF SUCH DAMAGE. # ----------------------------------------------------------------------------- ; -require 'test/unit' +require 'minitest/autorun' require 'blockenspiel' module Blockenspiel module Tests # :nodoc: - class TestBasic < ::Test::Unit::TestCase # :nodoc: + class TestBasic < ::Minitest::Test # :nodoc: class SimpleTarget < ::Blockenspiel::Base def initialize @@ -85,19 +85,20 @@ assert_equal(1, target_.get_value(:a)) assert_equal(2, target_.get_value(:b)) end - # Test basic usage with a mixin. + # Test basic usage with a delegator. # - # * Asserts that methods are mixed in to self. - # * Asserts that methods are removed from self afterward. - # * Asserts that the specified target object still receives the messages. + # * Asserts that the specified target object receives the messages. + # * Asserts that methods from the surrounding context are also available. + # * Asserts that methods are not present in self afterward. - def test_basic_mixin + def test_basic_parameterless block_ = ::Proc.new do set_value(:a, 1) set_value_by_block(:b){ 2 } + assert(true) end target_ = SimpleTarget.new ::Blockenspiel.invoke(block_, target_) assert(!self.respond_to?(:set_value)) assert(!self.respond_to?(:set_value_by_block))