The various dynamic matchers (contain_class, etc.) can't be composed or easily used in custom matchers. The problem is that rspec's values_match? method uses expected === actual to test for a match and the dynamic matchers don't implement #===.
A possible solution is to add a #=== method (or alias) to each of the CreateGeneric classes that delegates to #matches? so that values_match? checks for a match instead of object equality.
The various dynamic matchers (
contain_class
, etc.) can't be composed or easily used in custom matchers. The problem is that rspec'svalues_match?
method usesexpected === actual
to test for a match and the dynamic matchers don't implement#===
.A possible solution is to add a
#===
method (or alias) to each of theCreateGeneric
classes that delegates to#matches?
so thatvalues_match?
checks for a match instead of object equality.