RobL Vs

Background

Stubbing out live calls to via Facebooker

I just can’t find a way to stub out Facebooker::Service, this just didn’t seem to work.

1fs = mock_model(Facebooker::Service, :post => "1")
2Facebooker::Service.stub!(:new).and_return(fs)

So finally I used.

 1describe FacebookPublisher do
 2
 3  class Facebooker::Service
 4    def post(*args)
 5      return "1"
 6    end
 7  end
 8
 9  it "just should ok" do
10    Facebooker::Session.create.<some method thingy>
11  end
12
13end