Skip to content

Commit 33259e4

Browse files
committed
- Alias Spec#name to #inspect for cleaner output in repls.
[git-p4: depot-paths = "//src/minitest/dev/": change = 14607]
1 parent e2bc84c commit 33259e4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/minitest/spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def name # :nodoc:
290290
end
291291

292292
alias to_s name
293+
alias inspect name
293294

294295
attr_reader :desc # :nodoc:
295296
alias specify it

test/minitest/test_minitest_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,16 @@ def test_name
939939
assert_equal "ExampleB::random_method::addl_context", spec_c.name
940940
end
941941

942+
def test_inspect
943+
spec_a = describe ExampleA do; end
944+
spec_b = describe ExampleB, :random_method do; end
945+
spec_c = describe ExampleB, :random_method, :addl_context do; end
946+
947+
assert_equal "ExampleA", spec_a.inspect
948+
assert_equal "ExampleB::random_method", spec_b.inspect
949+
assert_equal "ExampleB::random_method::addl_context", spec_c.inspect
950+
end
951+
942952
def test_name2
943953
assert_equal "NamedExampleA", NamedExampleA.name
944954
assert_equal "NamedExampleB", NamedExampleB.name

0 commit comments

Comments
 (0)