spec/knapsack/allocator_spec.rb in knapsack-1.6.1 vs spec/knapsack/allocator_spec.rb in knapsack-1.7.0

- old
+ new

@@ -41,16 +41,28 @@ subject { allocator.stringify_node_tests } it { should eql node_tests.join(' ') } end describe '#test_dir' do - let(:test_file_pattern) { "test_dir/**{,/*/**}/*_spec.rb" } - subject { allocator.test_dir } - before do - expect(report_distributor).to receive(:test_file_pattern).and_return(test_file_pattern) + context 'when ENV test_dir has value' do + let(:test_dir) { "custom_dir" } + + before do + expect(Knapsack::Config::Env).to receive(:test_dir).and_return(test_dir) + end + + it { should eql 'custom_dir' } end - it { should eql 'test_dir/' } + context 'when ENV test_dir has no value' do + let(:test_file_pattern) { "test_dir/**{,/*/**}/*_spec.rb" } + + before do + expect(report_distributor).to receive(:test_file_pattern).and_return(test_file_pattern) + end + + it { should eql 'test_dir/' } + end end end