From 64be97bdfe029e0fa5f33a06963f4c18ca3968d4 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Fri, 8 Apr 2011 16:05:41 -0700 Subject: maint: Fix sqlite3 require to really be optional You need to specifically rescue LoadError if you want requires to be optional. Paired-with: Nick Lewis --- spec/unit/indirector/facts/inventory_active_record_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 4e20532c4..02dd495da 100755 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby require 'spec_helper' -require 'sqlite3' rescue nil +begin + require 'sqlite3' +rescue LoadError +end require 'tempfile' require 'puppet/rails' -- cgit From 7e9707a7d7b357d9b5167c6dd0dd250ab207f6ac Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Fri, 8 Apr 2011 16:06:31 -0700 Subject: maint: Fix sporadic sqlite error ActiveRecord::StatementInvalid: SQLite3::IOException: disk I/O error This happened if you ran these tests in the following order since Rails wasn't disconnecting between tests. rspec spec/unit/indirector/facts/inventory_active_record_spec.rb spec/unit/indirector/node/active_record_spec.rb Paired-with: Nick Lewis --- spec/unit/indirector/facts/inventory_active_record_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 02dd495da..0d5573999 100755 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -32,6 +32,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r after :each do Puppet::Rails.teardown + ActiveRecord::Base.remove_connection end describe "#save" do -- cgit