Skip to content

Using Koala with mockfacebook

arsduo edited this page Nov 14, 2011 · 5 revisions

Ryan Barrett's mockfacebook is a standalone HTTP server that implements Facebook's FQL and Graph API, providing an easy and useful way to run your unit and integration tests against a realistic Facebok interface.

Using Koala with mockfacebook is easy -- just add the following snippet to your spec_helper:

module Koala
  module HTTPService
    def self.server(options = {})
      "http://localhost:8000"
    end
  end
end

You can wrap that block in appropriate conditionals if you want to be able to toggle between live and mocked responses, like so:

if ENV["MOCK"] # or your preferred trigger
  # module Koala...
end

Important note: mockfacebook does not yet support the complete Facebook API; check out the documentation for a list of available features.

If there's enough interest, we can build support for mockfacebook directly into Koala.

Clone this wiki locally