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)
57
57
value . base_matcher . is_a? ( ::RSpec ::Matchers ::BuiltIn ::BeAKindOf )
58
58
end
59
59
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
+
60
66
def self . an_instance_of_something? ( value )
61
67
fuzzy_object? ( value ) &&
62
68
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
4
4
module Inspectors
5
5
class KindOf < SuperDiff ::ObjectInspection ::Inspectors ::Base
6
6
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 )
8
8
end
9
9
10
10
protected
11
11
12
12
def inspection_tree
13
13
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 } >"
16
21
end
17
22
end
18
23
end
You can’t perform that action at this time.
0 commit comments