I’m using ActiveResouce objects which don’t have a corresponding
ActiveRecord object in the DB because they’re acting as a front end to a
legacy Windows application which can read and write REST type XML.
That works fine, but when I try to do some unit testing
thenActiveSupport::TestCase when it’s setting up will try to delete
everything in the tables corresponding to ActiveRecords that it knows
about. Which it should do in preparation to loading fixtures. But in the
case of ActiveResources there’s no corresponding table, so it tries to
delete all records in a table, with the name that corresponds to the
ActiveResource, and then fails because it’s not there.
E.g. I have an ActiveResouce defined as
class ChoiceCustomers < ActiveResource::Base
Now when I try to run the unit test ChoiceCustomerTest <
even though there’s nothing in it apart from the default test, then I
get an error from the database when it tries to “delete from
choice_customers” because there’s no corresponding table.
How can I make sure that ActiveSupport::TestCase doesn’t regard
ActiveResources as ActiveRecords?