on another note, i saw your bowling example [_md’s].
I see how behat is very good on one side at the high level. You probably could have designed the class without relying on PHPSpec.
HOWEVER, if you chose to use PHPSpec once you got the red on behat and then came back after you greened all your PHPSpec descriptions just to ensure some adding of scenarios for completeness then it is great.
I believe bowling example is not very clear. But I see two patterns.
When the logic behavior (methods/what it does) described in the scenarios matches closely the class and when scenarios really describe acceptance behavior at a high level and it is not close to class behavior because the logic behavior is not very clear at the moment. This has to do I think with separation of concerns.
When separation of concerns is not clearly laid out or is mixed or embedded neatly into a behavior then it is hard to describe behavior that matches class behavior of the methods. When separation of concerns seems to be easily described with particular scenarios then we realize that separation of concerns has already been decoupled into method-like logic behavior (bowling case).
When separation of concerns is coupled and cannot be decoubled at the high level which is in most cases then extra procedure is followed:
1. PHPSpec will here be more heavily used to attempt the decoupling of the behavior in expected functionality, more and more fine grained each time or at least the description will be able to extend past the behat scenarios and can then describe some borders and more shape to what the class does. This is in all separation of concerns and some more other design.
2. After PHPSpec passes and Class(es) is(are) implemented then next step is to put to the test the Class(es) so designed and behat will fulfill the role of integration scenario BDD process.
So PHPSpec helps with separation and splitting to define finer behavior whereas Behat starts putting things back together to orchestrate things split to a larger view back together.
Expand-Collapse/Separation-Reunion concept of Design which is how things are designed.
I am currently working on a minesweeper example that shows perhaps some more clear this process… not sure how far i can get but i will try to be more clearer hopefully. Great job _md, this is a great advance in understanding these great tools! Behat+PHPSpec FTW.
Please let me know your thoughts!