Skip to content
Unverified Commit 7b54e540 authored by greenwoodcm's avatar greenwoodcm Committed by GitHub
Browse files

add `RuleBuilder::then_compute_output` (#4299)



this allows the developer to compute a mocked output using content from
the input.

## Motivation and Context
Some richer use cases for stubbing/mocking require computing a stubbed
output using data from the input, for instance stubbing a method that
returns the item that was put.

## Description
Add a new method to `RuleBuilder` that allows for providing a function
that computes the output. That function takes in a reference to the
input as an argument. I'm not sure how this works with the mutable
inputs like streamed bytes, but seems to work for the simple stuff.

## Testing
added a simple unit test

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: default avatarAaron Todd <aajtodd@users.noreply.github.com>
parent 9f495a45
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment