Closed blaix closed 8 years ago
...but in reality, I'd prefer to do something like that with a pipeline:
def validate(data):
# raises if invalid
return data
def persist(data):
# saves data to db
return saved_article
create_article = pipeline(validate, persist)
create_article({'some': 'data'})
To show the same stubbing/mocking separation using a pipeline action, I'd have to change it to show an example woma controller. Where the request is stubbed and the action and response are mocked.
Use stubs to set up responses for queries. Use mocks to verify commands. A Double can be used for either. The difference is in how you use them.
Use this woma-style action as an example (depends on #1 and #2):