【发布时间】:2012-10-23 14:18:56
【问题描述】:
我做了几个测试来检查我的 API 服务。在一项测试中,我将两个参数传递给 api/v1/pages/1 并且工作正常;这是代码
put "api/v1/pages/#{@page.id}", { "title" => "new title", "description" => "new description"} last_response.status.should eql(200)
现在我在将对象数组传递给服务时遇到问题。我尝试了一些东西,但没有成功。
@index = build(:index) //factory girl
@contact = build(:contact)
put "api/v1/pages/1/menu" ,[ //need to pass @index and @contact, and/or @index.name, @contact.name]
【问题讨论】:
-
你能把
rake routes的相关部分粘贴过来吗? -
PUT /api/v1/pages/:portfolio_id/menu(.:format) api/v1/pages#edit_menu_items {:format=>"json"}
标签: ruby-on-rails json rspec