Sha256: 52e723a0433c8e7554a4a5d13d4badf0cbf700884537244e2fe9f35f3b886d13

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Gator::Layout do

  before :each do
    @layout = Gator::Layout.new
  end

  it 'should expand empty to itself' do
    @layout.expand.should eql('')
    @layout.expand('').should eql('')
  end

  it 'should expand array of symbols' do
    @layout.expand(:foo, :bar).should eql('foo/bar')
  end

  it 'should expand array of names' do
    @layout.expand('foo', 'bar').should eql('foo/bar')
  end

  it 'should map symbol to path' do
    @layout[:foo] = 'baz'
    @layout.expand(:foo, :bar).should eql('baz/bar')
  end

  it 'should map symbols to path' do
    @layout[:foo, :bar] = 'none'
    @layout.expand(:foo, :bar).should eql('none')
  end

  it 'should map strings to path' do
    @layout[:foo, "bar"] = 'none'
    @layout.expand(:foo, :bar).should eql('none')
    @layout.expand(:foo, 'bar').should eql('none')
  end

  it 'should ignore nil elements' do
    @layout[:foo, :bar] = 'none'
    @layout.expand(:foo, nil, :bar).should eql('none')
    @layout.expand(nil, :foo).should eql('foo')
  end

  it 'should return nil if path not mapped' do
    @layout[:foo].should be_nil
  end

  it 'should return path from symbol' do
    @layout[:foo] = 'path'
    @layout[:foo].should eql('path')
  end

  it 'should return path from symbol' do
    @layout[:foo, :bar] = 'path'
    @layout[:foo, :bar].should eql('path')
  end

  it 'should do eager mapping' do
    @layout[:one] = 'none'
    @layout[:one, :two] = '1..2'
    @layout.expand(:one, :two, :three).should eql('1..2/three')
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gator-0.0.25.pre spec/core/project/layout_spec.rb
gator-0.0.24.pre spec/core/project/layout_spec.rb
gator-0.0.23.pre spec/core/project/layout_spec.rb
gator-0.0.22.pre spec/core/project/layout_spec.rb