Sha256: 20f1b594b824bd919439448b16a09645fe1ce95c8f03f6e94dc8504a2c9a0551

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

require 'spec/helper'

describe 'Node::generate_mapping' do
  def gen(const)
    Innate::Node.generate_mapping(const)
  end

  should 'transform class names into snake_case locations' do
    gen(     'O').should == '/o'
    gen(    'Oo').should == '/oo'
    gen(   'Ooo').should == '/ooo'
    gen(  'OooO').should == '/oooo'
    gen( 'OooOo').should == '/ooo_oo'
    gen('OooOoo').should == '/ooo_ooo'
    gen('OOOooo').should == '/oooooo'
    gen('OooOOO').should == '/oooooo'
    gen('OoOoOo').should == '/oo_oo_oo'
  end

  should 'transform namespaces into leading parts of the location' do
    gen('O::O').should == '/o/o'
    gen('O::O::O').should == '/o/o/o'
    gen('O::O::O::O').should == '/o/o/o/o'
  end

  should 'transform leading parts just like standalone part' do
    gen(     'O::O').should == '/o/o'
    gen(    'Oo::O').should == '/oo/o'
    gen(   'Ooo::O').should == '/ooo/o'
    gen(  'OooO::O').should == '/oooo/o'
    gen( 'OooOo::O').should == '/ooo_oo/o'
    gen('OooOoo::O').should == '/ooo_ooo/o'
    gen('OOOooo::O').should == '/oooooo/o'
    gen('OooOOO::O').should == '/oooooo/o'
    gen('OoOoOo::O').should == '/oo_oo_oo/o'
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
manveru-innate-2009.03.24 spec/innate/node/mapping.rb
manveru-innate-2009.04.01 spec/innate/node/mapping.rb
manveru-innate-2009.04.08 spec/innate/node/mapping.rb
manveru-innate-2009.04.18 spec/innate/node/mapping.rb
manveru-innate-2009.04 spec/innate/node/mapping.rb
manveru-innate-2009.05 spec/innate/node/mapping.rb
manveru-innate-2009.06.12 spec/innate/node/mapping.rb
manveru-innate-2009.06 spec/innate/node/mapping.rb
rjspotter-innate-2009.06.29 spec/innate/node/mapping.rb
rjspotter-innate-2009.06.30 spec/innate/node/mapping.rb
rjspotter-innate-2009.06.31 spec/innate/node/mapping.rb
innate-2009.04.12 spec/innate/node/mapping.rb
innate-2009.04 spec/innate/node/mapping.rb
innate-2009.06.12 spec/innate/node/mapping.rb
innate-2009.06 spec/innate/node/mapping.rb
innate-2009.05 spec/innate/node/mapping.rb