Skip to content

Commit

Permalink
Add minimal test files to reproduce the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
berdario committed Jan 25, 2017
1 parent e8b0bf5 commit a65fa39
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
6 changes: 6 additions & 0 deletions grails-app/taglib/spock/bug/BarTagLib.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package spock.bug

class BarTagLib {
static defaultEncodeAs = [taglib:'html']
//static encodeAsForTags = [tagName: [taglib:'html'], otherTagName: [taglib:'none']]
}
25 changes: 25 additions & 0 deletions test/unit/spock/bug/BarSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package spock.bug

import grails.test.mixin.TestFor
import grails.test.runtime.FreshRuntime
import org.springframework.context.i18n.LocaleContextHolder
import spock.lang.Specification
import spock.util.mop.ConfineMetaClassChanges


@ConfineMetaClassChanges([LocaleContextHolder])
@TestFor(BarTagLib)
@FreshRuntime
class BarSpec extends Specification {


def 'bar' () {
given:
LocaleContextHolder.metaClass.static.setLocale = { Locale locale ->

}
expect:
true
}

}
16 changes: 16 additions & 0 deletions test/unit/spock/bug/BazSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package spock.bug

import org.springframework.context.i18n.LocaleContextHolder
import spock.lang.Specification
import spock.util.mop.ConfineMetaClassChanges

@ConfineMetaClassChanges([LocaleContextHolder])
class BazSpec extends Specification {

def 'baz'() {
given:
LocaleContextHolder.locale = Locale.UK
expect:
Locale.UK == LocaleContextHolder.locale
}
}
16 changes: 16 additions & 0 deletions test/unit/spock/bug/FooSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package spock.bug

import org.springframework.context.i18n.LocaleContextHolder
import spock.lang.Specification
import spock.util.mop.ConfineMetaClassChanges

@ConfineMetaClassChanges(LocaleContextHolder)
class FooSpec extends Specification {

def 'foo'() {
given:
LocaleContextHolder.metaClass.static.getLocale = { Locale.UK }
expect:
true
}
}

0 comments on commit a65fa39

Please sign in to comment.