Sha256: 6c768d33843d2b69e3509b6f9f6c367fdcb965ac4a4d46ab8b35fa8bf957e47e

Contents?: true

Size: 1.98 KB

Versions: 39

Compression:

Stored size: 1.98 KB

Contents

describe KnapsackPro::SlowTestFileFinder do
  describe '.call' do
    let(:adapter_class) { double }

    subject { described_class.call(adapter_class) }

    before do
      expect(KnapsackPro::Config::Env).to receive(:test_files_encrypted?).and_return(test_files_encrypted?)
    end

    context 'when test files are not encrypted' do
      let(:test_files_encrypted?) { false }

      it do
        test_files_from_api = double
        time_execution = double
        build_distribution_entity = instance_double(KnapsackPro::BuildDistributionFetcher::BuildDistributionEntity, test_files: test_files_from_api, time_execution: time_execution)
        expect(KnapsackPro::BuildDistributionFetcher).to receive(:call).and_return(build_distribution_entity)

        merged_test_files_from_api = double
        expect(KnapsackPro::TestCaseMergers::BaseMerger).to receive(:call).with(adapter_class, test_files_from_api).and_return(merged_test_files_from_api)

        test_files_existing_on_disk = double
        expect(KnapsackPro::TestFileFinder).to receive(:select_test_files_that_can_be_run).with(adapter_class, merged_test_files_from_api).and_return(test_files_existing_on_disk)

        slow_test_files = double
        expect(KnapsackPro::SlowTestFileDeterminer).to receive(:call).with(test_files_existing_on_disk, time_execution).and_return(slow_test_files)

        expect(KnapsackPro::SlowTestFileDeterminer).to receive(:save_to_json_report).with(slow_test_files)

        expect(subject).to eq slow_test_files
      end
    end

    context 'when test files are encrypted' do
      let(:test_files_encrypted?) { true }

      it do
        expect { subject }.to raise_error RuntimeError, 'Split by test cases is not possible when you have enabled test file names encryption ( https://knapsackpro.com/perma/ruby/encryption ). You need to disable encryption with KNAPSACK_PRO_TEST_FILES_ENCRYPTED=false in order to use split by test cases https://knapsackpro.com/perma/ruby/split-by-test-examples'
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
knapsack_pro-7.9.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.8.2 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.8.1 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.8.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.7.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.6.2 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.6.1 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.6.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.1.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.0.1 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-7.0.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-6.0.4 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-6.0.3 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-6.0.2 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-6.0.1 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-6.0.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-5.7.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-5.6.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-5.5.0 spec/knapsack_pro/slow_test_file_finder_spec.rb
knapsack_pro-5.4.1 spec/knapsack_pro/slow_test_file_finder_spec.rb