Hello
I think you read about Mocketry and know that It provides same "should syntax" DSL like project Phexample.
There is problem between two projects. We both implement #should message in Object class. So when somebody want Phexample Mocketry become broken and vice versa.
In the past I actually only read about Phexample tests reusage idea with #given message. And I didn't know that It provides "should syntax" too.
Now I read about it and look at code (thank's Yuriy Tymchuk) and I have some suggestions about it.
First few words about state of Mocketry project.
Mocketry is not based on SSpec (I was google such wrong opinion). It is just implement SSpec idea about executable specifications and "should syntax".
And specifications part with DSL was extracted from Mocketry to StateSpecs project. So Mocketry is only about mocks and behaviour specs.
Idea of executable specifications is not about replacement "assert syntax" with "should syntax". It is about building reusable first class objects which can validate domain objects. For example there are EqualitySpec, ElementsCountSpec, ClassSpec. All this specs present "valid state" of objects. They know how to validate objects.
State specs can be used in tests, UI and any other domain where you want put descriptions about what it mean "valid object".
I start use StateSpecs in Presenty to build object editor. With specs I put requirements on model aspects.
I am sure Magritte provides something similar in description objects.
So StateSpecs solve very general problem: how to describe validation rules for objects and how to make such descriptions reusable.
To make it convenient and readable StateSpecs provides two kind of DSL:
- should syntax to immediately check object state
- first class words to create spec instances with more readable way: Instance of: SomeClass, Equal to: #some, Containing item: arrayItem and others
First option can be used in tests instead #assert: expressions. Last can be used in mock message arguments.
StateSpecs provide very simple way to extend it DSL based on pragmas: