Grails unit testing custom codec using Spock -
i'd create spock unit test test custom codec created. of examples see test custom codecs extending grailsunittestcase this. can point me in right direction on how using spock?
i ended doing following:
@testmixin(grailsunittestmixin) class securecodecspec extends specification { def setup() { grailsapplication.config.acme.encryption.password = 'topsecret' mockcodec(securecodec) } @unroll def "securecodec string value #original encodes , decodes properly"() { when: def encoded = original.encodeassecure() def decoded = encoded.decodesecure() then: original != encoded encoded != decoded original == decoded where: original | _ 'secret' | _ '' | _ }
}
Comments
Post a Comment