Sha256: 93da4800489d61aed5904d761dd3b70402c4e085ba02072684dfe91081990bc3

Contents?: true

Size: 770 Bytes

Versions: 5

Compression:

Stored size: 770 Bytes

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)

describe "String#snake_case" do

  it 'should snake_case a camelCase' do
    'CamelCase'.snake_case.should == 'camel_case'
  end

  it 'should snake_case a CamelCaseLong' do
    'CamelCaseLong'.snake_case.should == 'camel_case_long'
  end

  it 'will keep existing _' do
    'Camel_Case'.snake_case.should == 'camel__case'
  end

  it 'should replace spaces' do
    'Linked List'.snake_case.should == 'linked_list'
  end

  it 'should group uppercase words together' do
    'CSSController'.snake_case.should == 'css_controller'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/snippets/string/snake_case.rb
ramaze-2012.12.08 spec/snippets/string/snake_case.rb
ramaze-2012.12.08b spec/snippets/string/snake_case.rb
ramaze-2012.04.14 spec/snippets/string/snake_case.rb
ramaze-2012.03.07 spec/snippets/string/snake_case.rb