<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -90,19 +90,26 @@ def create_mysql(create, db_name)
 end
 
 # Test coverage
+gem 'spicycode-rcov' rescue nil
 begin
-  gem 'spicycode-rcov'
   require 'rcov/rcovtask'
 
-  task :cover =&gt; [:pretest, :rcov]
+  desc &quot;Generate coverage numbers for all locally installed versions of ActiveRecord&quot;
+  task :cover_all do
+    Gem.source_index.search(Gem::Dependency.new('activerecord', '&gt;=2.0')).each do |spec|
+      puts `rake cover AR_VERSION=#{spec.version}`
+    end
+  end
+
+  task :cover =&gt; [:pretest, :rcov_impl]
 
-  Rcov::RcovTask.new('rcov') do |t|
+  Rcov::RcovTask.new('rcov_impl') do |t|
     t.libs &lt;&lt; &quot;test&quot;
     t.test_files = FileList[&quot;test/*_test.rb&quot;]
-    t.output_dir = &quot;coverage&quot;
+    t.output_dir = &quot;coverage/#{ENV['AR_VERSION']}&quot;
     t.verbose = true
     t.rcov_opts = ['--text-report', '--exclude', &quot;test,Library,#{ENV['GEM_HOME']}&quot;, '--sort', 'coverage']
   end
-rescue GemError =&gt; e
+rescue LoadError =&gt; e
   puts 'Test coverage support requires \'gem install spicycode-rcov\''
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -81,6 +81,10 @@ module DataFabric
       set_role(old_role)
     end
     
+    def connected?
+      current_pool.connected?
+    end
+
   private
 
     def in_transaction?
@@ -134,10 +138,6 @@ module DataFabric
       current_pool.connection
     end
 
-    def active?
-      DataFabric.shard_active_for?(@shard_group)
-    end
-
     def set_role(role)
       Thread.current[:data_fabric_role] = role
     end</diff>
      <filename>lib/data_fabric/ar22.rb</filename>
    </modified>
    <modified>
      <diff>@@ -99,7 +99,7 @@ class ConnectionTest &lt; Test::Unit::TestCase
     if ar22?
       flexmock(ActiveRecord::ConnectionAdapters::ConnectionPool).new_instances.should_receive(:new_connection).and_return(AdapterMock.new(RawConnection.new))
     else
-      flexmock(klass).should_receive(:mysql_connection).and_return(AdapterMock.new(RawConnection.new))      
+      flexmock(clazz).should_receive(:mysql_connection).and_return(AdapterMock.new(RawConnection.new))      
     end
     ActiveRecord::Base.configurations ||= HashWithIndifferentAccess.new
     ActiveRecord::Base.configurations[name] = HashWithIndifferentAccess.new({ :adapter =&gt; 'mysql', :database =&gt; name, :host =&gt; 'localhost'})</diff>
      <filename>test/connection_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,17 +10,27 @@ class DatabaseTest &lt; Test::Unit::TestCase
   
   def setup
     ActiveRecord::Base.configurations = load_database_yml
-    DataFabric::ConnectionProxy.shard_pools.clear
+    if ar22?
+      DataFabric::ConnectionProxy.shard_pools.clear
+    end
   end
 
   def test_live_burrito
     DataFabric.activate_shard :city =&gt; :dallas do
       assert_equal 'fiveruns_city_dallas_test_slave', TheWholeBurrito.connection.connection_name
 
+      assert_raises RuntimeError do
+        TheWholeBurrito.connection_pool
+      end
+
+      assert !TheWholeBurrito.connected?
+
       # Should use the slave
       burrito = TheWholeBurrito.find(1)
       assert_match 'vr_dallas_slave', burrito.name
-      
+
+      assert TheWholeBurrito.connected?
+
       # Should use the master
       burrito.reload
       assert_match 'vr_dallas_master', burrito.name</diff>
      <filename>test/database_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>de38e1a371439972ba09a1817bde58290dc175f5</id>
    </parent>
  </parents>
  <author>
    <name>Mike Perham</name>
    <email>mperham@gmail.com</email>
  </author>
  <url>http://github.com/fiveruns/data_fabric/commit/28881ebe870ee682a4a687e4ff067ea8b18b42d0</url>
  <id>28881ebe870ee682a4a687e4ff067ea8b18b42d0</id>
  <committed-date>2008-12-01T10:48:31-08:00</committed-date>
  <authored-date>2008-12-01T10:48:31-08:00</authored-date>
  <message>Add 'cover_all' task to generate coverage for all installed AR versions.
Fix tests on AR &lt; 2.2, add testing for connected? and connection_pool
methods.</message>
  <tree>b9ce45cb95f9d7035711171c2271ccd9149c6495</tree>
  <committer>
    <name>Mike Perham</name>
    <email>mperham@gmail.com</email>
  </committer>
</commit>
