RunTimeError: ActionController :: RackDelegation in rspec 2.10.1 für Rails 3.1.4 Application Controller

In unserer Rails 3.1.4 Apprspec wird zum Testen der öffentlichen Methode verwendetrequire_signin im Anwendungscontroller. Hier ist die Methode require_signin:

  def require_signin
    if !signed_in?  
      flash.now.alert = "Log in first!"
      redirect_to signin_path
    end
  end  

Hier ist derrspec Code:

it "should invoke require_signin for those without login" do
  controller.send(:require_signin)
  controller {should redirect_to signin_path}  
end

Obenstehendesrspec erzeugt einen gigantischen mehrseitigen Fehler, der wie folgt beginnt:

RuntimeError:←[0m
       ←[31mActionController::RackDelegation#status= delegated to @_response.status=, but @_response is nil: #<ApplicationController:0x3
a67f10 @_routes=nil, @_action_has_layout=true, @_view_context_class=nil, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_reques
t=#<ActionController::TestRequest:0x3a68720 @env={"rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x34fad60>, ........

Was könnte falsch sein mit demrspec Code? Vielen Dank.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage