Sha256: 84857f6661d295e6ed642076a4c1e4de0ad094d1e675d1d07eb58c0d57a33b96

Contents?: true

Size: 1.16 KB

Versions: 38

Compression:

Stored size: 1.16 KB

Contents

describe KnapsackPro::BaseAllocatorBuilder do
  let(:adapter_class) { KnapsackPro::Adapters::BaseAdapter }
  let(:allocator_builder) { described_class.new(adapter_class) }

  describe '#allocator' do
    subject { allocator_builder.allocator }

    it do
      expect { subject }.to raise_error(NotImplementedError)
    end
  end

  describe '#test_dir' do
    subject { allocator_builder.test_dir }

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

    context 'when test_dir is defined in ENV' do
      let(:test_dir) { double }

      it { should eq test_dir }
    end

    context 'when test_dir is not defined in ENV' do
      let(:test_dir) { nil }

      before do
        expect(KnapsackPro::TestFilePattern).to receive(:call).with(adapter_class).and_return(test_file_pattern)
      end

      context 'when single pattern' do
        let(:test_file_pattern) { 'spec/**{,/*/**}/*_spec.rb' }

        it { should eq 'spec' }
      end

      context 'when multiple patterns' do
        let(:test_file_pattern) { '{spec/controllers/**/*.rb,spec/decorators/**/*.rb}' }

        it { should eq 'spec' }
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
knapsack_pro-1.15.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.14.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.13.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.12.1 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.12.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.11.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.10.1 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.10.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.9.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.8.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.7.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.6.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.5.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.4.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.3.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.2.1 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.2.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.1.0 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.0.2 spec/knapsack_pro/base_allocator_builder_spec.rb
knapsack_pro-1.0.1 spec/knapsack_pro/base_allocator_builder_spec.rb