Open simoleone opened 1 year ago
I believe that this issue on rspec-mocks covers the same issue and has a proposed solution.
See a POC here: https://github.com/ImmersiveLabsUkOrg/rspec-mocks/pull/2/files
@samuelgiles Would love your input on how to implement this in rspec-sorbet.
Thanks @multiplegeorges, will take a closer look at this shortly.
The call_validation_error_handler
approach that rspec-sorbet
uses right now happens wayyy after anything that'd help re: case
/#<=>
.
I like the idea of an approach that works at a lower level like the one in the POC as it could through Sorbet's public API mean we'd avoid having to maintain this method: https://github.com/samuelgiles/rspec-sorbet/blob/master/lib/rspec/sorbet/doubles.rb#L98-L118 + we might be able to support the doubles being a little more transparent to implementation logic.
For example code like this:
If a test does something like this:
It will hit the
T.absurd
, resulting in an error like this:I'm not sure there is any way to get around this given the way the
case
statement works but I figured it couldn't hurt to report in case someone had an idea 😄