Sha256: 5e392d67601ba1c0b8912405d1d9bc2783d28b460575cd36562ed8ea17e2bcfa

Contents?: true

Size: 816 Bytes

Versions: 28

Compression:

Stored size: 816 Bytes

Contents

module ActiveRecord::Turntable
  module Helpers
    module TestHelper
      # all shards
      def FabricateAll(name, overrides={}, &block)
        obj = Fabrication::Fabricator.generate(name, {
                                                 :save => true
                                               }, overrides, &block)

        default_pool = obj.class.connection_pool
        connection_pools = obj.class.connection_handler.instance_variable_get(:@connection_pools)

        ActiveRecord::Base.turntable_connections.each do |conn_name, conn|
          new_obj = obj.dup
          connection_pools[new_obj.class.name] = conn
          new_obj.id = obj.id
          new_obj.send(:create)
        end
        obj
      ensure
        connection_pools[obj.class.name] = default_pool
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
activerecord-turntable-2.5.0 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.4.0 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.3.3 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.3.2 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.3.1 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.3.0 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.2.2 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.2.1 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.2.0 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.1 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.0 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.0.rc2 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.0.rc1 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.0.beta2 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.1.0.beta1 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.0.6 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.0.5 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.0.4 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.0.3 lib/active_record/turntable/helpers/test_helper.rb
activerecord-turntable-2.0.2 lib/active_record/turntable/helpers/test_helper.rb