Skip to content
This repository
Browse code

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...
commit 5577af8d3776fc35ee0e67bdbfdf979df9cc5a5f 1 parent f20d4bf
Ryan Davis zenspider authored
8 lib/minitest/spec.rb
@@ -242,6 +242,10 @@ def create name, desc # :nodoc:
242 242 cls
243 243 end
244 244
  245 + def to_s # :nodoc:
  246 + defined?(@name) ? @name : (super rescue "dunno") # rescue is a 1.8 oddity
  247 + end
  248 +
245 249 # :stopdoc:
246 250 attr_reader :desc
247 251 alias :specify :it
@@ -252,10 +256,6 @@ def create name, desc # :nodoc:
252 256 extend DSL
253 257
254 258 TYPES = DSL::TYPES
255   -
256   - def self.to_s # :nodoc:
257   - defined?(@name) ? @name : super
258   - end
259 259 end
260 260
261 261 ##
8 test/minitest/test_minitest_spec.rb
@@ -650,6 +650,14 @@ def test_spec_type
650 650 MiniTest::Spec::TYPES.replace original_types
651 651 end
652 652
  653 + def test_name
  654 + spec_a = describe ExampleA do; end
  655 + spec_b = describe ExampleB, :random_method do; end
  656 +
  657 + assert_equal "ExampleA", spec_a.name
  658 + assert_equal "ExampleB::random_method", spec_b.name
  659 + end
  660 +
653 661 def test_structure
654 662 x, y, z, * = util_structure
655 663

0 comments on commit 5577af8

Please sign in to comment.
Something went wrong with that request. Please try again.