rails controller returning nil response while running casperjs test cases with shell script

给你一囗甜甜゛ 提交于 2019-12-11 11:15:46

问题


I am using casper test cases with a rails application, for running the test case I am using following command.

result = `cd #{Rails.root.join}/casper && casperjs test #{params[:file]}.js`

The above mentioned code is working fine on development environment(webrick) but if I run this on staging(nginx+passenger) then I am getting nil response within seconds that means that the script is running asynchronously, I need to run this synchronously so that I can send a JSON response to the client. the method that I am using for providing response is as follow.

def test
   @result = `cd #{Rails.root.join}/casper && casperjs test #{params[:file]}.js`
   render json: JSON.parse(@result) 
end

来源:https://stackoverflow.com/questions/28696685/rails-controller-returning-nil-response-while-running-casperjs-test-cases-with-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!