summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-09-22 15:27:54 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-22 21:37:50 -0700
commit6468f4ede9d96b8d83f107a8533a4ad6eb88c954 (patch)
tree7a50588737141e2361d166fa5e102089f3834f0e /spec
parent79d5fde2246cc20b0ace7ed3f273a5352931f6eb (diff)
downloadpuppet-6468f4ede9d96b8d83f107a8533a4ad6eb88c954.tar.gz
puppet-6468f4ede9d96b8d83f107a8533a4ad6eb88c954.tar.xz
puppet-6468f4ede9d96b8d83f107a8533a4ad6eb88c954.zip
(#4763) Don't call a method that was removed in Rails 3 activerecord
Calling this method caused storeconfigs not to run. ActiveRecord::Base.allow_concurrency was deprecated in Rails 2.2. We support activerecord 2.1 and higher, so we still need to call this method for 2.1. I factored out the code that determines our activerecord version to a method in util so that the code was easier to read and test.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/rails_spec.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb
index 13c5a8a25..01e822ff3 100755
--- a/spec/unit/rails_spec.rb
+++ b/spec/unit/rails_spec.rb
@@ -47,14 +47,20 @@ 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, ::ActiveRecord::VERSION::MINOR].join('.').to_f) >= 2.1 }
-
- it "should set ActiveRecord::Base.allow_concurrency" do
+ describe "ActiveRecord Version" do
+ it "should set ActiveRecord::Base.allow_concurrency if ActiveRecord is 2.1" do
+ Puppet::Util.stubs(:activerecord_version).returns(2.1)
ActiveRecord::Base.expects(:allow_concurrency=).with(true)
Puppet::Rails.connect
end
+
+ it "should not set ActiveRecord::Base.allow_concurrency if ActiveRecord is >= 2.2" do
+ Puppet::Util.stubs(:activerecord_version).returns(2.2)
+ ActiveRecord::Base.expects(:allow_concurrency=).never
+
+ Puppet::Rails.connect
+ end
end
it "should call ActiveRecord::Base.verify_active_connections!" do