views:

72

answers:

1

I have turned ActiveRecord off in my Rails app in the environment config:

Rails::Initializer.run do |config|
  config.frameworks -= [:active_record]
end

I have models that do not extend ActiveRecord::Base and I want to unit test these models. When I run the tests I get the uninitialized constant ActiveRecord::Base error.

How can I test my models when I don't have active record on?

+3  A: 

You could cheat. Add the following to your tests:

class ActiveRecord
    class Base
        end
    end

But first I'd recommend tracking down what is referring to ActiveRecord::Base. You think you aren't using it, but you may be wrong.

MarkusQ
Embarrassing. I totally had an temporary ActiveRecord model that I had not deleted. Thanks!
Sixty4Bit