Hi, whats the correct way to spec a rescue? This will raise it but doesnt test my code's response

# controller

  def edit
    @foo = Foo.find(params[:id])
  rescue
    flash[:notice] = "Unknown foo #{params[:id]}"
    redirect_to foos_path
  end


# spec

  it "should flash error if not found" do
    Foo.should_receive(:find).and_raise
    get :edit, :id => '1'
    flash[:notice].should == "Unknown foo 1"
  end

# run

Exception in...


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to