From: James Turnbull <[email protected]>
Signed-off-by: Matt Robinson <[email protected]> --- lib/puppet/feature/rails.rb | 2 +- lib/puppet/rails.rb | 2 +- spec/unit/rails_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/feature/rails.rb b/lib/puppet/feature/rails.rb index e0e14eb..2763b06 100644 --- a/lib/puppet/feature/rails.rb +++ b/lib/puppet/feature/rails.rb @@ -26,7 +26,7 @@ Puppet.features.add(:rails) do if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR)) false - elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1) + elsif ! (([::ActiveRecord::VERSION::MAJOR, ::ActiveRecord::VERSION::MINOR].join('.').to_f) >= 2.1) Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs" false else diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 414b1bc..6bf5d4a 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -22,7 +22,7 @@ module Puppet::Rails ActiveRecord::Base.logger.level = Logger::DEBUG end - if (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1) + if (([::ActiveRecord::VERSION::MAJOR, ::ActiveRecord::VERSION::MINOR].join('.').to_f) >= 2.1) ActiveRecord::Base.allow_concurrency = true end diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb index eaa9680..13c5a8a 100755 --- a/spec/unit/rails_spec.rb +++ b/spec/unit/rails_spec.rb @@ -48,7 +48,7 @@ describe Puppet::Rails, "when initializing any connection" do end describe "on ActiveRecord 2.1.x" do - confine("ActiveRecord 2.1.x") { ::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR <= 1 } + confine("ActiveRecord 2.1.x") { ([::ActiveRecord::VERSION::MAJOR, ::ActiveRecord::VERSION::MINOR].join('.').to_f) >= 2.1 } it "should set ActiveRecord::Base.allow_concurrency" do ActiveRecord::Base.expects(:allow_concurrency=).with(true) -- 1.7.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
