2014-01-22 44 views
0

我使用生成document.xls报告此XLS报告不Rails的测试环境中产生

宝石“excel_rails” 宝石“电子表格”

当我试图从我的浏览器,它看起来得到它一切都很正常,但是当我想从我的规格访问此类似这样的

get :document, { format: 'xls' } 

它会是这样

1) ***Controller GET document.xls assigns project_test_exceptions 
Failure/Error: get :document, document_params 
ActionView::Template::Error: 
    ***/document.xls.rxls:1: syntax error, unexpected '.', expecting keyword_end 
    ...t_buffer;;sio = StringIO.new; .write(sio); sio.string 
    ...        ^
# ./app/***_controller.rb:56:in `block (2 levels) in document' 
# ./app/***_controller.rb:55:in `document' 
# ./spec/***_spec.rb:301:in `block (3 levels) in <top (required)>' 

哪里可以出错?

+0

解决方案没有找到,所以我使用“to_spreadsheet”gem(https://github.com/glebm/to_spreadsheet)为xls代 – waj0x

回答

0

你应该仔细看thisexcel_rails宝石。它寻找一个模板来生成一个xls文件,所以你只需要在你的spec文件中添加一个render_views方法并且测试应该通过。

相关问题