且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 rspec 中指定内容类型

更新时间:2023-10-15 08:54:22

在 Rails 3 中,你可以跳过 header 和 @request.env 的东西,只需添加一个 format> 后调用的参数,例如:

In Rails 3, you can skip the header and @request.env stuff and just add a format parameter to your post call, e.g.:

post :create, format: :json, param: 'Value of Param'