Sha256: b4cefff194f5c1a748f48abe67eb995b0fa2f4420cc6806310744a9ea6cffaeb

Contents?: true

Size: 1.87 KB

Versions: 188

Compression:

Stored size: 1.87 KB

Contents

describe KnapsackPro::TestFlatDistributor do
  let(:test_flat_distributor) { described_class.new(test_files, node_total) }
  let(:node_total) { 2 }
  let(:test_files) do
    [
      { 'path' => 'spec/dir1/a_spec.rb' },
      { 'path' => 'spec/dir2/a_spec.rb' },
      { 'path' => 'spec/dir3/a_spec.rb' },
      { 'path' => 'spec/feature/e_spec.rb' },
      { 'path' => 'spec/models/b_spec.rb' },
      { 'path' => 'spec/feature/c_spec.rb' },
      { 'path' => 'spec/models/d_spec.rb' },
      { 'path' => 'spec/feature/a_spec.rb' },
      { 'path' => 'spec/models/f_spec.rb' },
      { 'path' => 'spec/models/g_spec.rb' },
      { 'path' => 'spec/dir4/h_spec.rb' },
      { 'path' => 'spec/models/i_spec.rb' },
    ]
  end

  describe '#nodes' do
    subject { test_flat_distributor.nodes }

    it do
      should eq({
        0 => [
          { 'path' => 'spec/feature/a_spec.rb' },
          { 'path' => 'spec/feature/e_spec.rb' },
          { 'path' => 'spec/models/d_spec.rb' },
          { 'path' => 'spec/models/g_spec.rb' },
          { 'path' => 'spec/dir1/a_spec.rb' },
          { 'path' => 'spec/dir3/a_spec.rb' },
        ],
        1 => [
          { 'path' => 'spec/feature/c_spec.rb' },
          { 'path' => 'spec/models/b_spec.rb' },
          { 'path' => 'spec/models/f_spec.rb' },
          { 'path' => 'spec/models/i_spec.rb' },
          { 'path' => 'spec/dir2/a_spec.rb' },
          { 'path' => 'spec/dir4/h_spec.rb' },
        ],
      })
    end
  end

  describe '#test_files_for_node' do
    subject { test_flat_distributor.test_files_for_node(1) }

    it do
      should eq([
        { 'path' => 'spec/feature/c_spec.rb' },
        { 'path' => 'spec/models/b_spec.rb' },
        { 'path' => 'spec/models/f_spec.rb' },
        { 'path' => 'spec/models/i_spec.rb' },
        { 'path' => 'spec/dir2/a_spec.rb' },
        { 'path' => 'spec/dir4/h_spec.rb' },
      ])
    end
  end
end

Version data entries

188 entries across 188 versions & 1 rubygems

Version Path
knapsack_pro-2.1.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-2.1.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-2.0.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.22.3 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.22.2 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.22.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.22.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.21.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.20.2 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.20.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.20.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.19.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.18.2 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.18.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.18.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.17.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.16.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.16.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.15.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-1.14.0 spec/knapsack_pro/test_flat_distributor_spec.rb