diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2009-11-08 15:36:52 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-11-17 20:45:00 +1100 |
| commit | f0eaf20f863f0f1fdcf01b620529f68609d4e0da (patch) | |
| tree | 36c6acce29ec47d541c02f4b212c4d98e0e6b0e0 /spec | |
| parent | eaab789ee08d3cc53b649a78d3cfe0ca833d2285 (diff) | |
| download | puppet-f0eaf20f863f0f1fdcf01b620529f68609d4e0da.tar.gz puppet-f0eaf20f863f0f1fdcf01b620529f68609d4e0da.tar.xz puppet-f0eaf20f863f0f1fdcf01b620529f68609d4e0da.zip | |
Fixing #2764 ActiveRecord 2.1 support
Suprisingly, I found that setting allow_concurrency made the
"MySQL server has gone away" stop occuring even if the MySQL server
drops connections.
This may be the only change needed to restore compatibility with
ActiveRecord 2.1.x
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/rails.rb | 11 |
1 files changed, 11 insertions, 0 deletions
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!) |
