Unit testing a controller method?
Posted
by Stefan Kendall
on Stack Overflow
See other posts from Stack Overflow
or by Stefan Kendall
Published on 2010-05-17T01:05:21Z
Indexed on
2010/05/17
1:10 UTC
Read the original article
Hit count: 366
I have a controller method like such:
def search = {
def query = params.query
...
render results as JSON
}
How do I unit test this? Specifically, how do I call search to set params.query
, and how do I test the results of the method render
? Is there a way to mock the render method, perhaps?
© Stack Overflow or respective owner