Sha256: c19ec309f8d92a22b0e581f4b51def537482beb35240841dbf32532f9a018203

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

describe KnapsackPro::TestFileFinder do
  describe '.call' do
    let(:test_file_pattern) { double }
    let(:test_files) { double }

    subject { described_class.call(test_file_pattern) }

    before do
      test_file_finder = instance_double(described_class, call: test_files)
      expect(described_class).to receive(:new).with(test_file_pattern).and_return(test_file_finder)
    end

    it { should eq test_files }
  end

  describe '#call' do
    let(:test_file_pattern) { 'spec_fake/**{,/*/**}/*_spec.rb' }

    subject { described_class.new(test_file_pattern).call }

    context 'when KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN is not defined' do
      it do
        should eq([
          {
            'path' => 'spec_fake/controllers/users_controller_spec.rb',
          },
          {
            'path' => 'spec_fake/models/admin_spec.rb',
          },
          {
            'path' => 'spec_fake/models/user_spec.rb',
          },
        ])
      end
    end

    context 'when KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN is defined' do
      let(:test_file_exclude_pattern) { 'spec_fake/controllers/*_spec.rb' }

      before do
        stub_const("ENV", { 'KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN' => test_file_exclude_pattern })
      end

      it do
        should eq([
          {
            'path' => 'spec_fake/models/admin_spec.rb',
          },
          {
            'path' => 'spec_fake/models/user_spec.rb',
          },
        ])
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
knapsack_pro-1.10.1 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.10.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.9.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.8.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.7.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.6.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.5.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.4.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.3.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.2.1 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.2.0 spec/knapsack_pro/test_file_finder_spec.rb
knapsack_pro-1.1.0 spec/knapsack_pro/test_file_finder_spec.rb