Permalink
Browse files

Fixed to_s to be in the DSL module. Had to jump through some hoops fo…

…r 1.8

[git-p4: depot-paths = "//src/minitest/dev/": change = 8295]
  • Loading branch information...
1 parent f20d4bf commit 5577af8d3776fc35ee0e67bdbfdf979df9cc5a5f @zenspider zenspider committed Mar 8, 2013
Showing with 12 additions and 4 deletions.
  1. +4 −4 lib/minitest/spec.rb
  2. +8 −0 test/minitest/test_minitest_spec.rb
View
@@ -242,6 +242,10 @@ def create name, desc # :nodoc:
cls
end
+ def to_s # :nodoc:
+ defined?(@name) ? @name : (super rescue "dunno") # rescue is a 1.8 oddity
+ end
+
# :stopdoc:
attr_reader :desc
alias :specify :it
@@ -252,10 +256,6 @@ def create name, desc # :nodoc:
extend DSL
TYPES = DSL::TYPES
-
- def self.to_s # :nodoc:
- defined?(@name) ? @name : super
- end
end
##
@@ -650,6 +650,14 @@ def test_spec_type
MiniTest::Spec::TYPES.replace original_types
end
+ def test_name
+ spec_a = describe ExampleA do; end
+ spec_b = describe ExampleB, :random_method do; end
+
+ assert_equal "ExampleA", spec_a.name
+ assert_equal "ExampleB::random_method", spec_b.name
+ end
+
def test_structure
x, y, z, * = util_structure

0 comments on commit 5577af8

Please sign in to comment.