I'm trying to use Model < ActiveRecord::Base in one of my gem tests with shoulda and I'm getting the following error
./test/model.rb:1:in `require': no such file to load -- active_record (LoadError)
Without this call, I'm getting this error
./test/model.rb:1: uninitialized constant ActiveRecord (NameError)
Help! I need a barebones AR model for my tests :)
my_gem/test/model.rb
require 'active_record' # <= this fails class Model < ActiveRecord::Base # <= I need a barebones AR model here acts_as_flaggable end my_gem/test/test_acts_as_flaggable.rb
require 'helper' require 'model' class TestActsAsFlaggable < Test::Unit::TestCase context "a model" do setup do @model = Model.new end should "be able to set flag" do @model.flag[:foo] = "bar" assert_equal "bar", @model.flag[:foo] end should "get default value for unset flags" do @model = User.new assert_equal false, @model.flag[:some_unset_flag] end end end Disclaimer: I'm very new to testing. This is my first gem and I wanted to make sure I was doing things the "right" way :)