require 'test_helper' module TaskAssertions def assert_proper_name_of_current(namespace) Pathname.stubs(:pwd).returns Pathname("path/to/php_test") namespace.stubs(:clean_name).with do |arg| assert_equal "php_test", arg.to_s true end.returns "result" assert_equal "result", namespace.name_of_current end end class WebsiteTasksTest < Test::Unit::TestCase include TaskAssertions def test_name_of_current assert_proper_name_of_current TASKS.website end end class AppTypeTasksTest < Test::Unit::TestCase include TaskAssertions def test_name_of_current assert_proper_name_of_current TASKS.apptype end end