Sha256: 0eb940fb326cc5f4c7c5e1a59ab603f5f472a6a424e66c6b9305e4ea58594d11

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'data_paths/finders'

require 'spec_helper'
require 'helpers/data'

describe DataPaths::Finders do
  before(:all) do
    @example = DataClass.new
  end

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

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

  it "should find all matching files" do
    @example.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
    @example.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
    @example.data_glob('*/*.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

1 entries across 1 versions & 1 rubygems

Version Path
data_paths-0.2.1 spec/finders_spec.rb