Sha256: dbb7fbead420eef44401194b0407a08fdbfbacbbd515cb2780917f0610940829

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'helpers/data'

require 'data_paths/finders'

describe DataPaths::Finders do
  subject do
    Class.new {
      include DataPaths
      include DataPaths::Finders
    }.new
  end

  it "should find a file" do
    subject.find_data_file('one.txt').should == File.join(Helpers::DATA_DIRS[0],'one.txt')
  end

  it "should find a directory" do
    subject.find_data_dir('dir').should == File.join(Helpers::DATA_DIRS[0],'dir')
  end

  it "should find all matching files" do
    subject.all_data_files('dir/two.txt').should == [
      File.join(Helpers::DATA_DIRS[0],'dir','two.txt'),
      File.join(Helpers::DATA_DIRS[1],'dir','two.txt')
    ]
  end

  it "should find all matching directories" do
    subject.all_data_dirs('dir').should == [
      File.join(Helpers::DATA_DIRS[0],'dir'),
      File.join(Helpers::DATA_DIRS[1],'dir')
    ]
  end

  it "should find all paths matching a pattern" do
    subject.glob_data_paths('*/*.txt').should == [
      File.join(Helpers::DATA_DIRS[0],'dir','two.txt'),
      File.join(Helpers::DATA_DIRS[1],'dir','two.txt')
    ]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
data_paths-0.3.0.rc2 spec/finders_spec.rb
data_paths-0.3.0.rc1 spec/finders_spec.rb