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
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. |
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
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"() { |
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
Maximum length: <span><gorm:limit clazz='com.igor.GormTagLibUser' field='username'/></span> | |
<input name='username' maxlength="${gorm.limit(clazz: 'com.igor.GormTagLibUser', field: 'username')}" /> |
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
Maximum length: <span>50</span> | |
<input name='username' maxlength='50' /> |
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
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] |
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
customTestReportDir="/new/report/path" |
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
eventTestSuiteEnd = { | |
if (config.customTestReportDir) { | |
junitReportStyleDir = config.customTestReportDir | |
} | |
} |
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
// 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 |
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
void doSomething(def foo) { | |
println foo | |
} | |
void doSomethingElse(int bar) { | |
println bar | |
} | |
doSomething() | |
doSomethingElse() // Throws MissingMethodException |
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
void doSomething(def foo, def newParam = null) { | |
println foo | |
} | |
void doSomethingAgain(def baz, def newParam) { | |
println baz | |
} | |
doSomething() // Throws MethodSelectionException | |
doSomethingAgain('Test') // Throws MissingMethodException |