Sha256: 5207312b4367ae1c4104a5a43c5af8caccb64c1d68d94623dcaea6fac31199b3

Contents?: true

Size: 651 Bytes

Versions: 145

Compression:

Stored size: 651 Bytes

Contents

require 'test_helper'

class CassandraObject::BatchesTest < CassandraObject::TestCase
  test 'find_each' do
    Issue.create 
    Issue.create 

    issues = []
    Issue.find_each do |issue|
      issues << issue
    end

    assert_equal Issue.all.to_set, issues.to_set
  end

  test 'find_in_batches' do
    Issue.create 
    Issue.create
    Issue.create
    
    issue_batches = []
    Issue.find_in_batches(batch_size: 2) do |issues|
      issue_batches << issues
    end
    
    assert_equal 2, issue_batches.size
    assert issue_batches.any? { |issues| issues.size == 2 }
    assert issue_batches.any? { |issues| issues.size == 1 }
  end
end

Version data entries

145 entries across 145 versions & 2 rubygems

Version Path
sessionm-cassandra_object-4.0.32 test/batches_test.rb
sessionm-cassandra_object-4.0.31 test/batches_test.rb
sessionm-cassandra_object-4.0.30 test/batches_test.rb
sessionm-cassandra_object-4.0.29 test/batches_test.rb
sessionm-cassandra_object-4.0.28 test/batches_test.rb
sessionm-cassandra_object-4.0.27 test/batches_test.rb
sessionm-cassandra_object-4.0.26 test/batches_test.rb
sessionm-cassandra_object-4.0.25 test/batches_test.rb
sessionm-cassandra_object-4.0.24 test/batches_test.rb
sessionm-cassandra_object-4.0.23 test/batches_test.rb
sessionm-cassandra_object-4.0.22 test/batches_test.rb
sessionm-cassandra_object-4.0.21 test/batches_test.rb
sessionm-cassandra_object-4.0.20 test/batches_test.rb
sessionm-cassandra_object-2.7.5 test/batches_test.rb
sessionm-cassandra_object-2.7.4 test/batches_test.rb
sessionm-cassandra_object-4.0.18 test/batches_test.rb
sessionm-cassandra_object-4.0.17 test/batches_test.rb
sessionm-cassandra_object-4.0.16 test/batches_test.rb
sessionm-cassandra_object-4.0.15 test/batches_test.rb
sessionm-cassandra_object-4.0.14 test/batches_test.rb