Hi, I am trying to stub a class in my controller and I can't get it to work, the controller code is:
def show @server = Server.find(params[:id]) whm = Whm::Client.new @server @server_load = whm.loadavg end and my test code: before(:each) do @server = mock_model(Server) Server.stub!(:find).and_return(@server) end def do_get get :show, :id => "1" end it "should be successful" do Whm::Client.stub!(:new) Whm::Client.stub!(:loadavg) do_get response.should be_success end After running my tests I get a failure message: 'ServersController handling GET /servers/1 should be successful' FAILED expected success? to return true, got false ./spec/controllers/servers_controller_spec.rb:63: I'm not really sure how to stub this kind of class call. Thanks Jamie _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users