Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Mar 9, 2015
1 parent 88b510f commit 8832f11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Expand Up @@ -880,8 +880,14 @@ public static AnnotationNode addEnhancedAnnotation(final ClassNode classNode, fi
final List<AnnotationNode> annotations = classNode.getAnnotations(ENHANCED_CLASS_NODE);
if (annotations.isEmpty()) {
enhancedAnnotationNode = new AnnotationNode(ENHANCED_CLASS_NODE);
enhancedAnnotationNode.setMember("version", new ConstantExpression(getGrailsVersion()));
classNode.addAnnotation(enhancedAnnotationNode);
String grailsVersion = getGrailsVersion();
if(grailsVersion == null) {
grailsVersion = System.getProperty("grails.version");
}
if(grailsVersion != null) {
enhancedAnnotationNode.setMember("version", new ConstantExpression(grailsVersion));
classNode.addAnnotation(enhancedAnnotationNode);
}
} else {
enhancedAnnotationNode = annotations.get(0);
}
Expand Down
Expand Up @@ -18,6 +18,11 @@ class GrailsArtefactTransformerSpec extends Specification {
gcl = new GrailsAwareClassLoader()
def transformer = new TestTransformer()
gcl.classInjectors = [transformer]as ClassInjector[]
System.setProperty("grails.version", "3.0.0")
}

void cleanupSpec() {
System.setProperty("grails.version", "")
}

void "Test that a marker annotation can be added to weaved methods"() {
Expand Down Expand Up @@ -140,7 +145,7 @@ class GrailsArtefactTransformerSpec extends Specification {
def version = enhancedAnnotation.version()

then:
version == GrailsUtil.grailsVersion
version == "3.0.0"
}

void 'Test mixins attribute on @Enhanced'() {
Expand All @@ -157,7 +162,7 @@ class GrailsArtefactTransformerSpec extends Specification {
def version = enhancedAnnotation.version()

then:
version == GrailsUtil.grailsVersion
version == "3.0.0"
enhancedAnnotation.mixins() == [Date] as Class[]
}
}
Expand Down

0 comments on commit 8832f11

Please sign in to comment.