[rspec-users] need some advice on the best way to structure testable shared methods
patmaddox at me.com
Tue Nov 15 20:44:35 EST 2011
On Nov 14, 2011, at 4:57 PM, Patrick J. Collins wrote:
> Can anyone suggest a better way?
Really tough to follow that example, so apologies if I'm off.
I use the template method pattern for stuff like this. My shared example group references a method that isn't implemented. Example groups that use that shared example group then define it using let. And of course you can parameterize the shared example groups or pass it a context. See https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples for some examples.
More information about the rspec-users