collectiveidea / interactor

Interactor provides a common interface for performing complex user interactions.
MIT License
3.36k stars 212 forks source link

Update the README testing example to one that works #80

Closed michaelherold closed 9 years ago

michaelherold commented 9 years ago

The example of how to testing Interactors in the README does not work in the current version of interactor. This is a huge barrier to entry for anyone looking to use the library. We should update the README to indicate how tests should actually be done.

Note: This commit is just intended to add the spec to show that it fails. I will add a second commit in a moment to show the method that I use to test my Interactors.

michaelherold commented 9 years ago

Hopefully this PR is structured in a way that makes sense. I can add another commit that removes spec/readme_spec.rb if that's not something that should stick around. If that is wanted, I'll add a [ci skip] since it would just be a documentation update at that point.

Thanks for making such a fun interactor library. I'm really enjoying it compared to the previous library I used and am liking some of the discussion for the future of the gem.

posgarou commented 9 years ago

I was running into the same difficulty just now, looking at the tests in the README.

I think you can also modify the test in the README to replace calls of interactor.call with interactor.run and still get the expected behavior. (See the code for run here.)

michaelherold commented 9 years ago

Hmm, fair enough. I liked the #call syntax better, as it feels more like issuing a command.

philipgiuliani commented 9 years ago

Looks good :) @posgarou the .run should not be used, its an internal method and may change in every update.

laserlemon commented 9 years ago

I merged #84 with an updated readme because it applied cleanly. Thank you for your help!