Created
March 9, 2013 20:48
-
-
Save metaskills/5125688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb | |
index 8d8df55..6e005e0 100644 | |
--- a/lib/minitest/spec.rb | |
+++ b/lib/minitest/spec.rb | |
@@ -243,13 +243,16 @@ class MiniTest::Spec < MiniTest::Unit::TestCase | |
end | |
def to_s # :nodoc: | |
- defined?(@name) ? @name : (super rescue "dunno") # rescue is a 1.8 oddity | |
+ defined?(@name) ? @name : super | |
+ end | |
+ | |
+ def name # :nodoc: | |
+ defined?(@name) ? @name : super | |
end | |
# :stopdoc: | |
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
Why not have
name
callto_s
? Orto_s
callname
?