【发布时间】:2014-08-10 18:46:47
【问题描述】:
我正在测试my model methods,无论如何我可以访问request 或response 标头。
require 'spec_helper'
describe Project do
it "can find an Project that this user belongs to" do
project = Project.find( id: '22', authorization: @auth ) // Rest API Call
expect(response.code).to eq(200);
end
end
当我尝试访问我的response.code 时,我得到undefined method/variable 的响应。如何访问我的响应标头。
更新我的项目模型:
class Project < ActiveRestClient::Base
base_url "https://domainname.com"
get :find, '/project/:id/'
end
【问题讨论】:
-
@zishe:如果您注意到响应链接...他正在访问 PlayersController 而不是 PlayersModel 方法。
-
@zishe:你没有???
-
我在这段代码中没有看到请求。你应该展示你的模型,也许它有。
-
@zishe:这是我的模型。 pastie.org/private/0o18pnqmto2drzymxwktw
标签: ruby-on-rails ruby rspec active-rest-client