Skip to content

Commit

Permalink
Add Artefact annotation for Grails artefacts defined in test classes
Browse files Browse the repository at this point in the history
- @ArteFact("Controller") for controllers
- @ArteFact("TagLib") for taglibs
  • Loading branch information
lhotari committed Jan 28, 2014
1 parent 6548b2d commit 895dab2
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
@@ -1,5 +1,7 @@
package grails.test.mixin

import grails.artefact.Artefact

/**
*
*/
Expand Down Expand Up @@ -31,6 +33,8 @@ class ControllerAndMockForTests {
}

}

@Artefact("Controller")
class MyController {

def index() {
Expand Down
@@ -1,5 +1,6 @@
package grails.test.mixin

import grails.artefact.Artefact;
import grails.converters.JSON
import grails.converters.XML
import grails.test.mixin.web.ControllerUnitTestMixin
Expand Down Expand Up @@ -400,6 +401,7 @@ class ControllerUnitTestMixinTests extends GroovyTestCase {
}
}

@Artefact("Controller")
class TestController {

static allowedMethods = [action2: 'POST', action3: ['POST', 'PUT'], method2: 'POST', method3: ['POST', 'PUT']]
Expand Down Expand Up @@ -546,6 +548,7 @@ class TestCommand {
}
}

@Artefact("Controller")
class SubController extends TestController {
def method1() {
super.method1()
Expand Down
@@ -1,5 +1,7 @@
package grails.test.mixin

import grails.artefact.Artefact;

import org.junit.Test

/**
Expand Down Expand Up @@ -36,6 +38,7 @@ class ControllerWithMockCollabTests {
}
}

@Artefact("Controller")
class ControllerWithCollabController {

def myCallable
Expand Down
@@ -1,5 +1,6 @@
package grails.test.mixin

import grails.artefact.Artefact;
import grails.converters.XML
import grails.persistence.Entity

Expand Down Expand Up @@ -238,6 +239,7 @@ class Author {
static hasMany = [books: Book]
}

@Artefact("Controller")
class BookController {

static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
Expand Down
@@ -1,5 +1,6 @@
package grails.test.mixin

import grails.artefact.Artefact;
import grails.test.GrailsMock
import grails.test.mixin.web.FiltersUnitTestMixin
import org.junit.Before
Expand Down Expand Up @@ -117,6 +118,7 @@ class FiltersUnitTestMixinTests {
}
}

@Artefact("Controller")
class AuthorController {
def list = { [authors:['bob', 'fred']]}
}
Expand Down
@@ -1,5 +1,6 @@
package grails.test.mixin

import grails.artefact.Artefact
import grails.test.mixin.web.UrlMappingsUnitTestMixin
import grails.web.Action
import junit.framework.AssertionFailedError
Expand Down Expand Up @@ -162,15 +163,17 @@ class AnotherUrlMappings {
}
}

@Artefact("Controller")
class GrailsUrlMappingsTestCaseFakeController {
static defaultAction = 'action1'
@Action def action1(){}
@Action def action2(){}
@Action def action3(){}
def action1(){}
def action2(){}
def action3(){}
}

@Artefact("Controller")
class UserController {
@Action def publicProfile() {}
def publicProfile() {}
}

class MyUrlMappings {
Expand Down
@@ -1,5 +1,6 @@
package org.codehaus.groovy.grails.web.converters

import grails.artefact.Artefact;
import grails.converters.XML
import grails.test.mixin.TestFor

Expand All @@ -22,6 +23,7 @@ class ControllerWithXmlConvertersTests {
}
}

@Artefact("Controller")
class XmlController {

def convertArray() {
Expand Down
@@ -1,13 +1,8 @@
package org.codehaus.groovy.grails.web.pages

import org.junit.BeforeClass;

import grails.artefact.Artefact
import grails.test.AbstractGrailsEnvChangingSpec

import spock.lang.Specification
import grails.test.mixin.TestFor
import grails.util.Environment;
import grails.artefact.Artefact

@TestFor(TagLibMethodMissingTagLib)
class TagLibMethodMissingSpec extends AbstractGrailsEnvChangingSpec {
Expand Down Expand Up @@ -73,6 +68,7 @@ class TagLibMethodMissingTagLib {
}
}

@Artefact("TagLib")
class TagLibMethodMissingBTagLib {
static namespace = "other"

Expand Down

0 comments on commit 895dab2

Please sign in to comment.