Sha256: 725debfcd54d4c70ab8d8bd35b2c9f63a0ffd516e5f8d80e8b2684a1627c2dae
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
# -*- coding: utf-8 -*- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') describe DirTreeWalker do it 'should accept option :ignore with regex' do walker = DirTreeWalker.new :ignore => /^\./ expect(walker.ignore_file?('.thumbnails')).to be true expect(walker.ignore_dir?('.thumbnails')).to be true end it 'should accept option :ignore with string' do walker = DirTreeWalker.new :ignore => '.git' expect(walker.ignore_file?('.git')).to be true expect(walker.ignore_dir?('.git')).to be true end it 'should accept option :ignore_dir' do dtw = DirTreeWalker.new :ignore_dir => [/^\./, "private_dir" ] expect(dtw.ignore_dir?('.git')).to be true expect(dtw.ignore_dir?('private_dir')).to be true end it 'should accept option :ignore_file' do dtw = DirTreeWalker.new :ignore_file => [/.xml/, /(ignore)|(orig)/ ] expect(dtw).to be_ignore_file('pippo.xml') end it 'should accept option :match with string' do dtw = DirTreeWalker.new :match => '.jpg' expect(dtw).to be_match('foo.jpg') end it 'should accept option :match with regex' do dtw = DirTreeWalker.new :match => /.jpg/ expect(dtw).to be_match('foo.jpg') end it 'should ignore files and directory' do walker = DirTreeWalker.new('.') walker.ignore(/^\./) expect(walker.ignore_file?('.thumbnails')).to be true expect(walker.ignore_dir?('.thumbnails')).to be true walker.ignore_dir('thumbnails') expect(walker.ignore_dir?('.thumbnails')).to be true expect(walker.ignore_dir?('thumbnails')).to be true expect(walker.ignore_dir?('pippo')).to be false walker.ignore_file('xvpics') expect(walker.ignore_file?('xvpics')).to be true walker.ignore('sub') expect(walker.ignore_file?('[Dsube]')).to be false expect(walker.ignore_dir?('[Dsube]')).to be false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tree.rb-0.3.13 | spec/tree_rb/input_file_system/directory_walker_conf_spec.rb |