Created
July 22, 2010 00:14
-
-
Save zspencer/485365 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
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]) | |
} | |
} |
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
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 | |
} |
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
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