Skip to content

Instantly share code, notes, and snippets.

@zspencer
Created July 22, 2010 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zspencer/485365 to your computer and use it in GitHub Desktop.
Save zspencer/485365 to your computer and use it in GitHub Desktop.
def save = {
def project = new Project(params)
if(!project.hasErrors() && project.save(flush:true)) {
redirect(action:'edit',id:project.id)
} else {
render(view:'create',model:[project:project])
}
}
protected void setUp() {
super.setUp()
mockDomain(Project,[])
mockDomain(Client,[])
}
public void testSaveNewProjectRedirect(){
controller.params.name = "project one"
controller.params.description = "a project to test"
controller.params.id = 1
controller.save()
assertEquals "edit", controller.redirectArgs.action
}
controller.redirectArgs is null??!?!?!?!
controller.save() returns null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment