summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/rails.rb4
-rwxr-xr-xspec/unit/rails.rb11
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index fc8eacd68..87f1bb1fb 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -22,6 +22,10 @@ module Puppet::Rails
ActiveRecord::Base.logger.level = Logger::DEBUG
end
+ if (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1)
+ ActiveRecord::Base.allow_concurrency = true
+ end
+
ActiveRecord::Base.verify_active_connections!
begin
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index d98c88774..6dee55b0e 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -39,6 +39,7 @@ describe Puppet::Rails, "when initializing any connection" do
ActiveRecord::Base.stubs(:logger).returns(logger)
logger.expects(:level=).with(Logger::DEBUG)
+ ActiveRecord::Base.stubs(:allow_concurrency=)
ActiveRecord::Base.stubs(:verify_active_connections!)
ActiveRecord::Base.stubs(:establish_connection)
Puppet::Rails.stubs(:database_arguments)
@@ -46,6 +47,16 @@ describe Puppet::Rails, "when initializing any connection" do
Puppet::Rails.connect
end
+ describe "on ActiveRecord 2.1.x" do
+ confine "ActiveRecord 2.1.x" => (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1)
+
+ it "should set ActiveRecord::Base.allow_concurrency" do
+ ActiveRecord::Base.expects(:allow_concurrency=).with(true)
+
+ Puppet::Rails.connect
+ end
+ end
+
it "should call ActiveRecord::Base.verify_active_connections!" do
ActiveRecord::Base.expects(:verify_active_connections!)