Sha256: 6406fc8a1cb7e62dd247a8b1cd93eed6a738f0f83afc6e674f7450142d620de0
Contents?: true
Size: 1.4 KB
Versions: 40
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe Killbill::Plugin::ActiveMerchant::ActiveRecord do before(:all) do ::Killbill::Test::TestPaymentMethod.delete_all end it 'should stream results per batch' do 1.upto(35) do ::Killbill::Test::TestPaymentMethod.create(:kb_account_id => SecureRandom.uuid, :kb_payment_method_id => SecureRandom.uuid, :kb_tenant_id => SecureRandom.uuid, :token => SecureRandom.uuid, :created_at => Time.now.utc, :updated_at => Time.now.utc) end ::Killbill::Test::TestPaymentMethod.count.should == 35 enum = ::Killbill::Plugin::ActiveMerchant::ActiveRecord::StreamyResultSet.new(40, 10) do |offset, limit| ::Killbill::Test::TestPaymentMethod.where('kb_payment_method_id is not NULL') .order('id ASC') .offset(offset) .limit(limit) end i = 0 enum.each do |results| if i < 3 results.size.should == 10 elsif i == 3 results.size.should == 5 else fail 'Too many results' end i += 1 end end end
Version data entries
40 entries across 40 versions & 1 rubygems