我有个测试
describe 'PUT #start' do
before do
put :start, abtest_id: @variation.abtest.id.to_s,
variation_id: @variation.id.to_s, format: 'json'
end
it "shoud return HTTP 200 status code" do
expect(response.response_code).to eql(200)
end
end这是我们的回应
Failure/Error: expect(response.response_code).to eql(200)
expected: 200
got: 405
(compared using eql?)我不能向rspec提出请求。有人会有别的办法来测试吗?
发布于 2015-05-05 22:16:47
405的意思是“不允许方法”,例如,端点接受POST请求,但不接受PUT请求。
如果不查看实现,就不可能知道问题是在规范中还是在被测试的端点中。
https://stackoverflow.com/questions/30059366
复制相似问题