Sha256: dafc122974080c1bba63666cd093884a1fc559ae628b0b6a5a1754a4a5388c19

Contents?: true

Size: 743 Bytes

Versions: 4

Compression:

Stored size: 743 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'minitest'
require 'active_record'
require 'postgresql_cursor'

ActiveRecord::Base.establish_connection(adapter: 'postgresql',
  database: ENV['TEST_DATABASE'] || 'postgresql_cursor_test',
  username: ENV['TEST_USER']     || ENV['USER'] || 'postgresql_cursor')

class Product < ActiveRecord::Base
  has_many :prices

  # create table records (id serial primary key);
  def self.generate(max=1_000)
    max.times do |i|
      connection.execute("insert into products values (#{i+1})")
    end
  end
end

class Price < ActiveRecord::Base
  belongs_to :product
end

Product.destroy_all
Product.generate(1000)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
postgresql_cursor-0.6.8 test/helper.rb
postgresql_cursor-0.6.7 test/helper.rb
postgresql_cursor-0.6.6 test/helper.rb
postgresql_cursor-0.6.5 test/helper.rb