期望响应为< 3XX:重定向>,但是< 200:OK>

时间:2016-05-17 05:56:58

标签: ruby-on-rails rspec functional-testing

rspec

  context "No user logged in" do
    it "redirects to login" do
      get :show, id: @user.id
      expect(response).to redirect_to("/login")
    end
  end
end

端 不确定哪里出错

1 个答案:

答案 0 :(得分:0)

我有同样的问题,我用这个

修复了
  response = get :show, id: @user.id
  p response.body
  expect(response.body).to eql(#HERE THE BODY OF YOUR RESPONSE)