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-6.0.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.7.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.6.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.5.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.4.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.4.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.5 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.4 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.3 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.2 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.3.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.2.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.2.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.1.2 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.1.1 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.1.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-5.0.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-4.1.0 spec/knapsack_pro/test_flat_distributor_spec.rb
knapsack_pro-4.0.0 spec/knapsack_pro/test_flat_distributor_spec.rb