Created
July 19, 2016 14:36
-
-
Save ddelponte/b0d27754d1bee2bdb5ac75b709b1cd56 to your computer and use it in GitHub Desktop.
Mock out the render method on a tagLib so that it's easy to verify the template and model utilized by the tagLib when rendering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup | |
private mockTagLibRender() { | |
tagLib.metaClass.render = { Map attrs -> | |
render = attrs | |
} | |
} | |
// Utilization | |
given: | |
mockTagLibRender() | |
CoolThing coolThing = new CoolThing() | |
when: | |
tagLib.renderCoolThing( | |
now: "now", | |
derp: "derp" | |
) | |
then: | |
render.template == "this/template/is/used/to/render" | |
render.model.now == "now" | |
render.model.derp == "derp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment