ruby-on-railsactiveresource

ActiveResource::Base models seek table while testing


I have an Airport model which extends ApplicationRecord and ApplicationRecord extends ActiveResource::Base

class ApplicationRecord < ActiveResource::Base
end

class Airport < ApplicationRecord
end

When i run tests, it gives me error like:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "airports" does not exist LINE 1: DELETE FROM "airports" ^ : DELETE FROM "airports"

Why does it look for airport table? All models extends from ActiveResource::Base and i don't have any table for models. So I can't run tests. How can i disable look up for tables in test mode? In development mode there is no problem like that.


Solution

  • Ok, i found the solution. It is because

    fixtures :all

    line in test/test_helper.rb

    after remove the line, it works well