Skip to content

Instantly share code, notes, and snippets.

@ishults
ishults / problem.groovy
Last active December 16, 2015 20:03
Introduction of the problem
void doSomething(def foo) {
println foo
}
void doSomethingElse(int bar) {
println bar
}
doSomething()
doSomethingElse() // Throws MissingMethodException
@ishults
ishults / Grails_Groovy_Versions.txt
Last active February 9, 2023 18:04
List of Groovy versions for Grails
// Compiled by Igor Shults
// Last Updated: July 23, 2020
GRAILS GROOVY SOURCE
4.1.0 2.5.14 https://github.com/grails/grails-core/blob/v4.1.0/gradle.properties
4.0.4 2.5.6
4.0.3 2.5.6
4.0.2 2.5.6
4.0.1 2.5.6
4.0.0 2.5.6 https://github.com/grails/grails-core/blob/v4.0.0/build.gradle
eventTestSuiteEnd = {
if (config.customTestReportDir) {
junitReportStyleDir = config.customTestReportDir
}
}
customTestReportDir="/new/report/path"
import spock.lang.Specification
class SampleSpec extends Specification {
def "example of power assert output"() {
when:
String first = 'The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.'
String second = '123The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog'
then:
assert [foo: first] == [foo: second]
Maximum length: <span>50</span>
<input name='username' maxlength='50' />
@ishults
ishults / gormTagLibSamples.html
Last active December 16, 2015 20:04
Sample usages
Maximum length: <span><gorm:limit clazz='com.igor.GormTagLibUser' field='username'/></span>
<input name='username' maxlength="${gorm.limit(clazz: 'com.igor.GormTagLibUser', field: 'username')}" />
package com.igor
import grails.test.mixin.*
import org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException
import spock.lang.Specification
import spock.lang.Unroll
@TestFor(GormTagLib)
class GormTagLibSpec extends Specification {
void "limit() should throw an exception if attributes are missing or wrong"() {
package com.igor
import org.codehaus.groovy.grails.validation.ConstrainedProperty
class GormTagLib {
static namespace = 'gorm'
/**
* Returns the max length of a field for a given domain.
package com.igor
import grails.validation.Validateable
@Validateable
class GormTagLibUser {
String username
String firstName
String middleName
String lastName