From 581f45711961059fd22d5fe53114ab7f7d4721c0 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 14 Jul 2018 11:03:16 +0300 Subject: [PATCH] type helper for class name --- lib/parfait/type.rb | 6 +++++- test/parfait/type/test_basic.rb | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/parfait/type.rb b/lib/parfait/type.rb index 003c29f3..2d4b1112 100644 --- a/lib/parfait/type.rb +++ b/lib/parfait/type.rb @@ -63,8 +63,12 @@ module Parfait end end + def class_name + @object_class.name + end + def to_s - "#{@object_class.name}-#{@names.inspect}" + "#{class_name}-#{@names.inspect}" end def method_names diff --git a/test/parfait/type/test_basic.rb b/test/parfait/type/test_basic.rb index d2a49e58..ecfb749d 100644 --- a/test/parfait/type/test_basic.rb +++ b/test/parfait/type/test_basic.rb @@ -72,5 +72,11 @@ module Parfait type = @mess.get_type assert_equal type , @mess.get_internal_word(0) end + def test_to_s + assert @type.to_s.include?(@type.object_class.name.to_s) + end + def test_class_name + assert_equal :Message , @type.class_name + end end end