Sha256: 16b6fb5b06fc66a5fe2bfb01cec5360d652fab204f5a6c80846873d426a14a79

Contents?: true

Size: 1.95 KB

Versions: 25

Compression:

Stored size: 1.95 KB

Contents

describe Rake::Funnel::Extensions::CommonPath do
  describe 'Manual debugging test case' do
    it 'should work' do
      expect(%w(/common/one /com/two).common_path).to be

      skip('for manual testing only')
    end
  end

  describe 'modification of FileList' do
    it 'should not modify the input' do
      input = FileList[File.join(File.dirname(__FILE__), '**/*')]
      duped = input.dup

      expect(input.common_path).to be
      expect(input).to match_array(duped)
    end
  end

  {
    array: [
      { input: [], expected: '' },
      { input: %w(one two), expected: '' },
      { input: %w(1-common 2-common), expected: '' },
      { input: %w(common.1 common-2), expected: '' },
      { input: %w(common-1 common-2), expected: '' },
      { input: %w(/common common), expected: '' },
      { input: %w(/ /foo), expected: '/' },
      { input: %w(/common/one /com/two), expected: '/' },
      { input: %w(/common/1 /common/2), expected: '/common' },
      { input: %w(/common/1 /common/2 /common/3/4), expected: '/common' },
      { input: %w(/common /common), expected: '/common' },
      { input: %w(/common /common/), expected: '/common' },
      { input: %w(/common/ /common/), expected: '/common' },
      { input: ['common/ 1', 'common/ 2'], expected: 'common' },
      { input: ['com mon/1', 'com mon/2'], expected: 'com mon' },
      { input: [' common/1', ' common/2'], expected: ' common' },
      { input: ['common /1', 'common /2'], expected: 'common ' },
      { input: [''], expected: '' },
      { input: ['', nil], expected: '' }
    ],
    file_list: [
      { input: FileList.new, expected: '' },
      { input: FileList['lib/*', 'spec/*'], expected: '' },
      { input: FileList['spec/*'], expected: 'spec' }
    ]
  }.each do |group, pairs|
    describe group do
      pairs.each do |pair|
        it "#{pair[:input]} should equal '#{pair[:expected]}'" do
          expect(pair[:input].common_path).to eq(pair[:expected])
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rake-funnel-0.21.2 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.21.1 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.21.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.20.2 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.20.1 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.20.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.19.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.18.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.17.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.16.1 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.16.0 spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.15.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.14.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.13.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.12.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.11.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.10.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.9.1.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.9.0.pre spec/rake/funnel/extensions/common_path_spec.rb
rake-funnel-0.8.0.pre spec/rake/funnel/extensions/common_path_spec.rb