Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created March 9, 2013 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/5125357 to your computer and use it in GitHub Desktop.
Save metaskills/5125357 to your computer and use it in GitHub Desktop.
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index 8d8df55..009eb9a 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -247,9 +247,13 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
end
# :stopdoc:
+ def self.included(cls)
+ cls.class_eval do
+ alias :name :to_s
+ end
+ end
attr_reader :desc
alias :specify :it
- alias :name :to_s
# :startdoc:
end
diff --git a/test/minitest/test_minitest_spec.rb b/test/minitest/test_minitest_spec.rb
index 3b18359..57718c8 100755
--- a/test/minitest/test_minitest_spec.rb
+++ b/test/minitest/test_minitest_spec.rb
@@ -6,6 +6,8 @@ class MiniSpecA < MiniTest::Spec; end
class MiniSpecB < MiniTest::Spec; end
class ExampleA; end
class ExampleB < ExampleA; end
+class DslExampleA; extend MiniTest::Spec::DSL; end
+class DslExampleB < DslExampleA; end
describe MiniTest::Spec do
# do not parallelize this suite... it just can"t handle it.
@@ -658,6 +660,11 @@ class TestMeta < MiniTest::Unit::TestCase
assert_equal "ExampleB::random_method", spec_b.name
end
+ def test_dsl_name
+ assert_equal "DslExampleA", DslExampleA.name
+ assert_equal "DslExampleB", DslExampleB.name
+ end
+
def test_structure
x, y, z, * = util_structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment