Sha256: 88e44cc1a8210482e6c09c84e2c8de8ae675f0faf3c27e675b6011964894dd51

Contents?: true

Size: 974 Bytes

Versions: 19

Compression:

Stored size: 974 Bytes

Contents

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

share_examples_for "an object that manages paths" do
  before do
    @path_manager.add_path :testing, '/testing'
    @path_manager.add_path :first,   '/1'
  end
  
  it 'returns a string when given a string' do
    @path_manager.path_to('hi').should == 'hi'
  end

  it 'returns a path when given a registered symbol' do
    @path_manager.path_to(:testing).should == '/testing'
  end

  it 'raises an error when given a unregistered symbol' do
    lambda { @path_manager.path_to(:foobar) }.should raise_error(IMW::PathError)
  end
  
  it 'returns a constructed path when passed a mixture of symbols, strings, and arrays ' do
    @path_manager.path_to( [:testing, 'hi'], [[['there']]]).should == '/testing/hi/there'
  end
  
  it 'will correctly expand paths themselves defined via symbols' do
    @path_manager.add_path(:first, :testing, '1')
    @path_manager.path_to(:first).should == '/testing/1'
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
imw-0.2.18 spec/imw/utils/shared_paths_spec.rb
imw-0.2.17 spec/imw/utils/shared_paths_spec.rb
imw-0.2.16 spec/imw/utils/shared_paths_spec.rb
imw-0.2.15 spec/imw/utils/shared_paths_spec.rb
imw-0.2.14 spec/imw/utils/shared_paths_spec.rb
imw-0.2.13 spec/imw/utils/shared_paths_spec.rb
imw-0.2.12 spec/imw/utils/shared_paths_spec.rb
imw-0.2.11 spec/imw/utils/shared_paths_spec.rb
imw-0.2.10 spec/imw/utils/shared_paths_spec.rb
imw-0.2.9 spec/imw/utils/shared_paths_spec.rb
imw-0.2.8 spec/imw/utils/shared_paths_spec.rb
imw-0.2.7 spec/imw/utils/shared_paths_spec.rb
imw-0.2.6 spec/imw/utils/shared_paths_spec.rb
imw-0.2.5 spec/imw/utils/shared_paths_spec.rb
imw-0.2.4 spec/imw/utils/shared_paths_spec.rb
imw-0.2.3 spec/imw/utils/shared_paths_spec.rb
imw-0.2.2 spec/imw/utils/shared_paths_spec.rb
imw-0.2.1 spec/imw/utils/shared_paths_spec.rb
imw-0.2.0 spec/imw/utils/shared_paths_spec.rb