我应该如何编写401重定向的期望?

时间:2014-02-05 15:56:50

标签: rspec

#excerpt
subject { response }
its(:response_code){ should eq 401 }
it { should redirect_to '/sign_in' }

返回:

Failures:

  1) UsersController GET #edit when not signed in should redirect to "/sign_in"
     Failure/Error: it { should redirect_to '/sign_in' }
       Expected response to be a <redirect>, but was <401>

我认为401是重定向?或者rspec的redirect_to方法是否专门寻找302?

0 个答案:

没有答案