【发布时间】:2014-08-07 13:14:49
【问题描述】:
我从服务器收到 json 响应。
{
"@type": "res",
"createdAt": "2014-07-24T15:26:49",
"description": "test",
"disabled": false
}
我如何测试response 是right 还是wrong。下面是我的测试用例。
it "can find an account that this user belongs to" do
Account.find(id: @acc.id, authorization: @token);
expect(response.status).to eq 200
expect(response.body).to eq({
"@type": "res",
"createdAt": "2014-07-24T15:26:49",
"description": "test",
"disabled": false
})
end
当我尝试执行测试时,它会抛出很多语法错误。
【问题讨论】:
标签: ruby-on-rails json ruby-on-rails-3 rspec