“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey (contact@robl.me)
Senior Software Engineer, Brighton, UK

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.

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

So finally I used.

describe FacebookPublisher do

  class Facebooker::Service
    def post(*args)
      return "1"
    end
  end

  it "just should ok" do
    Facebooker::Session.create.<some method thingy>
  end

end