Sha256: 72bc3d7681eb1767603b91b043dd4c2985f6379369276815f7869fb08127adf8

Contents?: true

Size: 1.17 KB

Versions: 18

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path('../../../helper', __FILE__)

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

18 entries across 18 versions & 2 rubygems

Version Path
innate-2023.01.06 spec/innate/node/mapping.rb
innate-2015.10.28 spec/innate/node/mapping.rb
manveru-innate-2009.07 spec/innate/node/mapping.rb
innate-2013.02.21 spec/innate/node/mapping.rb
innate-2013.02 spec/innate/node/mapping.rb
innate-2012.12 spec/innate/node/mapping.rb
innate-2012.03 spec/innate/node/mapping.rb
innate-2011.12 spec/innate/node/mapping.rb
innate-2011.10 spec/innate/node/mapping.rb
innate-2011.04 spec/innate/node/mapping.rb
innate-2011.01 spec/innate/node/mapping.rb
innate-2010.07 spec/innate/node/mapping.rb
innate-2010.06.18 spec/innate/node/mapping.rb
innate-2010.04 spec/innate/node/mapping.rb
innate-2010.03 spec/innate/node/mapping.rb
innate-2010.01 spec/innate/node/mapping.rb
innate-2009.10 spec/innate/node/mapping.rb
innate-2009.07 spec/innate/node/mapping.rb