diff --git a/spec/lib/database.rb b/spec/lib/database.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/database.rb
+++ b/spec/lib/database.rb
@@ -52,7 +52,7 @@ module ScopedSearch::RSpec::Database
       end
     end
 
-    klass = Class.new(ActiveRecord::Base)
+    klass = ScopedSearch::RSpec::Database.const_set(table_name.classify, Class.new(ActiveRecord::Base))
     klass.table_name = table_name
     yield(klass) if block_given?
     return klass
Make sure a named constant is created to keep AR2 happy.