Sha256: fa1bb56a9aa5071f1b8a2b29f7601f9ad098bbd54b10dd396a770325800fcd95

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

require File.join(File.dirname(__FILE__),'../../spec_helper')
require 'imw'
require 'imw/utils/paths'

describe IMW do
  include IMW
  before(:each) do
    IMW::PATHS = {
      :data    => '/data',
      :weather => 'ftp.ncdc.noaa.gov/pub/data/noaa',
      :first   => ['1', :second, 'last'],
      :second  => ['2', :third],
      :third   => ['3'],
    }
  end

  it 'is idempotent on a string' do
    path_to('hi').should == 'hi'
  end

  it 'has an absolute path to the data dir' do
    path_to(:data).should =~ %r{^/}
  end

  it 'handles mixed array and sym args' do
    path_to( [:data, 'hi'], [[['there']]]).should == '/data/hi/there'
  end

  it 'expands to later generations' do
    path_to(:first).should == File.join('1/2/3/last')
  end

  it 'expands interior symbols' do
    path_to(['hadoop1:/working', :data, :weather]).should ==
      File.join('hadoop1:/working/data/ftp.ncdc.noaa.gov/pub/data/noaa')
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imw-0.1.1 spec/imw/utils/paths_spec.rb
imw-0.1.0 spec/imw/utils/paths_spec.rb