Topic: ActiveResource Test Fixtures

Does anyone know a way to simulate test fixtures with ActiveResource?

  I have an application that uses ActiveResource to consume external web services.  I'd like to be able to test my application without needing the external web services to be operational.  Most importantly, I'd like to develop the erb for my views without  needing to connect to any external web services.

  When using ActiveRecord, I typically seed the DB with sample data.  This allows me to develop the views.  I want a similar workflow with ActiveResource without needing to actually communicate to an external service.

Re: ActiveResource Test Fixtures

Quick follow up on how I have proceeded.

  I decided that what I really needed was a way to mock out the external web services that my application was consuming.  Therefore, I developed a mock web service using Sinatra!

  Sinatra allowed me to set up a web service that I could consume using ActiveResource.  Not only did this give me complete control of the output of the web service, but it allowed me to use my ActiveResource models without needing the production services to be up and running.

  Hope this helps someone else.

Re: ActiveResource Test Fixtures

SethG wrote:

Does anyone know a way to simulate test fixtures with ActiveResource?

  I have an application that uses ActiveResource to consume external web services.  I'd like to be able to test my application without needing the external web services to be operational.  Most importantly, I'd like to develop the erb for my views without  needing to connect to any external web services.

  When using ActiveRecord, I typically seed the DB with sample data.  This allows me to develop the views.  I want a similar workflow with ActiveResource without needing to actually communicate to an external service.







Nice and very interesting post. Your opinion is more or less the same as main. Thanks!
Daily Deals Sydney
Daily Deals Sydney