Stubbing ActiveResource in development with Rails

117 Views Asked by At

We are currently in the process of splitting our monolithic rails app into multiple rails apps and are using ActiveResource to pull data from one app to another. In development this is a massive pain as we have to run two rails apps locally in order to develop on one on them. This will only get worse as we split out into more apps.

Does anyone have a solution on how to essentially stub or create a dummy version of external apps so that they don't have to run every app just to develop on one? We are currently thinking of a dummy rack app or something like that.

1

There are 1 best solutions below

0
On

Try fakeweb gem. It is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs.

You could do something like

FakeWeb.register_uri(:get, %r|products.xml|, :body => File.read("<xml_file>"))