Last active
August 29, 2015 14:02
-
-
Save alvarosanchez/2aa7f59d5859b664d5b4 to your computer and use it in GitHub Desktop.
This file contains 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.odobo.gr8conf | |
import grails.rest.RestfulController | |
import grails.transaction.Transactional | |
@Transactional(readOnly = true) | |
class CategoryController extends RestfulController { | |
static responseFormats = ['json', 'xml'] | |
CategoryController() { | |
super(Category) | |
} | |
} |
This file contains 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
class CategorySpec extends Specification { | |
@Shared | |
RESTClient restClient = new RESTClient("http://localhost:8080/restful-gr8conf-2014") | |
def "it returns just the categories of a game when is a nested resource"() { | |
when: | |
Response response = restClient.get(path: "/games/5/categories", accept: ContentType.JSON) | |
println response.json | |
then: | |
response.json.size() == 2 | |
} | |
} |
This file contains 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.odobo.gr8conf | |
import grails.rest.RestfulController | |
import grails.transaction.Transactional | |
@Transactional(readOnly = true) | |
class GameController extends RestfulController { | |
static responseFormats = ['json', 'xml'] | |
GameController() { | |
super(Game) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment