File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
rspec/object_inspection/inspectors Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,12 @@ def self.a_kind_of_something?(value)
5757 value . base_matcher . is_a? ( ::RSpec ::Matchers ::BuiltIn ::BeAKindOf )
5858 end
5959
60+ # HINT: `a_kind_of` is a matcher in the rspec-expectations gem.
61+ # `kind_of` is an argument matcher in the rspec-mocks gem.
62+ def self . kind_of_something? ( value )
63+ value . is_a? ( ::RSpec ::Mocks ::ArgumentMatchers ::KindOf )
64+ end
65+
6066 def self . an_instance_of_something? ( value )
6167 fuzzy_object? ( value ) &&
6268 value . base_matcher . is_a? ( ::RSpec ::Matchers ::BuiltIn ::BeAnInstanceOf )
Original file line number Diff line number Diff line change @@ -4,15 +4,20 @@ module ObjectInspection
44 module Inspectors
55 class KindOf < SuperDiff ::ObjectInspection ::Inspectors ::Base
66 def self . applies_to? ( value )
7- SuperDiff ::RSpec . a_kind_of_something? ( value )
7+ SuperDiff ::RSpec . a_kind_of_something? ( value ) || SuperDiff :: RSpec . kind_of_something? ( value )
88 end
99
1010 protected
1111
1212 def inspection_tree
1313 SuperDiff ::ObjectInspection ::InspectionTree . new do
14- add_text do |aliased_matcher |
15- "#<a kind of #{ aliased_matcher . expected } >"
14+ add_text do |value |
15+ klass = if SuperDiff ::RSpec . a_kind_of_something? ( value )
16+ value . expected
17+ else
18+ value . instance_variable_get ( :@klass )
19+ end
20+ "#<a kind of #{ klass } >"
1621 end
1722 end
1823 end
You can’t perform that action at this time.
0 commit comments