Rspec: Test rescue block
问题 I have a block like this: begin response = Facebook.make_profile_request(params[:token]) rescue => e Airbrake.notify( :error_class => "Facebook Processing", :error_message => "Error: #{e.message}" ) flash[:notice] = "Uh oh...something went wrong. Please try again." redirect_to root_path end This is what I have so far: it "should notify Airbrake if call to FB fails" do Facebook.stub(:make_profile_request).with(fb_token).and_raise(Exception) Airbrake.should_receive(:notify) get :facebook