- 的Grails 2.2.4
- 斯波克0.7
我想測試正確的觀點是從一個Grails控制器呈現。我的創建方法如下:使用Grails斯波克單元測試斷言視圖控制器
def create() {
def documentCategories = DocumentCategory.list()
def documentTypes = DocumentType.list()
def documentComponents = DocumentComponent.list()
[documentCategories: documentCategories,
documentTypes: documentTypes,
documentComponents:documentComponents]
}
而且我的測試:
def "test create action"() {
given:
def model = controller.create()
expect:
response.status == 200
model.documentCategories.size() == 0
model.view == '/document/create'
}
我已經試過各種版本的model.view
包括:
view == '/document/create'
response.forwardedUrl == '/document/create'
所有這些失敗,因爲model.view
,view
,和response.forwardedUrl
都是空的。建議?
凹凸填充!你有沒有解決它?我處於類似的情況...... – marko