Sha256: 36ddcca5871e5bfe9b57a04c64c361478dafc3011beaa7fe938b798b51e3556f

Contents?: true

Size: 631 Bytes

Versions: 31

Compression:

Stored size: 631 Bytes

Contents

require 'test_helper'

class Superstore::BatchesTest < Superstore::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

31 entries across 31 versions & 1 rubygems

Version Path
superstore-2.4.4 test/unit/scope/batches_test.rb
superstore-2.4.3 test/unit/scope/batches_test.rb
superstore-2.4.2 test/unit/scope/batches_test.rb
superstore-2.4.1 test/unit/scope/batches_test.rb
superstore-2.4.0 test/unit/scope/batches_test.rb
superstore-2.3.0 test/unit/scope/batches_test.rb
superstore-2.2.0 test/unit/scope/batches_test.rb
superstore-2.1.3 test/unit/scope/batches_test.rb
superstore-2.1.2 test/unit/scope/batches_test.rb
superstore-2.1.1 test/unit/scope/batches_test.rb
superstore-2.1.0 test/unit/scope/batches_test.rb
superstore-2.0.1 test/unit/scope/batches_test.rb
superstore-2.0.0 test/unit/scope/batches_test.rb
superstore-1.2.0 test/unit/scope/batches_test.rb
superstore-1.1.4 test/unit/scope/batches_test.rb
superstore-1.1.3 test/unit/scope/batches_test.rb
superstore-1.1.2 test/unit/scope/batches_test.rb
superstore-1.1.1 test/unit/scope/batches_test.rb
superstore-1.1.0 test/unit/scope/batches_test.rb
superstore-1.0.12 test/unit/scope/batches_test.rb