Sha256: 62a402ecb6716fe06d40a91dc4e937c241a7f3bc99fd0cab6be961fe75ec8e36

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

require File.expand_path('../spec_helper', __FILE__)

module Depcheck

  describe Finder do

    describe :find_derived_data_path do
      before do
        allow(Finder).to receive(:`).and_return(" OBJROOT = D/D\n PROJECT_NAME = P\n TARGET_NAME = T")
      end

      it 'finds derived data path' do
        expected = "D/D/P.build/**/T.build"
        expect(Finder.find_derived_data_path("Test", nil, nil)).to eq expected
      end
    end

    describe :find_swiftdeps do
      before do
        allow(Finder).to receive(:find_derived_data_path).and_return('')
      end

      it 'finds swiftdeps files' do
        expected = 2.times.map(&:to_s)
        allow(Dir).to receive(:glob).and_return(expected)
        expect(Finder.find_swiftdeps("Test", nil, nil)).to eq expected
      end

      it 'raises error if files not found' do
        allow(Dir).to receive(:glob).and_return([])
        expect{Finder.find_swiftdeps("Test", nil, nil)}.to raise_error(StandardError)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
depcheck-0.4.0 spec/finder_spec.rb
depcheck-0.3.0 spec/finder_spec.rb