-
Notifications
You must be signed in to change notification settings - Fork 58
Pacto templating #14
Comments
Actually we already have this feature! Sadly it's not on the Readme. You can use ERB (I know, not the most portable thing) and what we are calling File Preprocessors to template the contracts. It's a very simple implementation of the templating idea and it needs to be improved, we also could use a more portable format, like mustache. |
Cool. That makes it easier. So I think we'll add docs/tests for this using ERB, and we can look later if setting up alternate templating engines makes sense. |
@marcosccm It didn't really make it as easy as we'd hoped.... One problem was that it was a preprocessor. We would need a postprocessor for a lot of stuff. For example, if you just want to return We also had to disable the hash-deep-merge while using an ERB post processor. We used the same system of passing values, but we wanted to use either HDM or ERB, not both. Finally, the InstantiatedContract has caused a lot of confusion for us. We're not clear on the differences between Contract and InstantiatedContract. I think it may make more sense to use a hook with a request/response signature instead of a processor that acts on a contract. Similar to WebMock.after_request or VCR's before_playback hook. So we should chat, this PR will probably require a few refactors. |
Fixed w/ #18. |
We believe Pacto needs a templating system. This is useful both because:
The text was updated successfully, but these errors were encountered: