Remove /grails-app from “..., Grails automatically created a shell unit-test case in /grails-app/test/unit/QuoteServiceTests.groovy”
Remove /grails-app from “This will tell Grails to create a shell /grails-app/test/integration/QuoteService-IntegrationTests.groovy file.”
class QuoteServiceTests extends GrailsUnitTestCaseshould be
class QuoteServiceIntegrationTests extends GrailsUnitTestCase
This has the same issue as listing 1.17
The test fails because “Quiche“ should not be capitalized. The assertion should read
assertEquals("Real Programmers Don't eat Quiche", staticQuote.content)
should be
assertEquals("Real Programmers Don't eat quiche", staticQuote.content)
Remove /grails-app from “Grails also generates an HTML version of our test results, which you can view by opening /grails-app/test/reports/html/index.html in a web browser.”
The code
render "<q>${randomQuote.content}<q>" +
"<p>${randomQuote.author}</p>"
should be
response.outputStream << "<q>${randomQuote.content}<q>" +
"<p>${randomQuote.author}</p>"
This is because the render() method applies the quote.gsp layout to the generated output, which isn’t what we want.
The example for inList is missing a closing “]”. It should be
country(inList: ['Australia', 'England'])