Sha256: 8931f68b0e350078570f30c8a6407dd1ea6142ebeb35b1a3004d1cb2b55b0e41

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'extra_core/string_transformation_test_cases'
require 'volt/extra_core/string'

describe '#camelize' do
  CamelToUnderscore.each do |camel, underscore|
    it 'camelizes' do
      expect(underscore.camelize).to eq(camel)
    end
  end

  it 'camelizes lower' do
    expect('capital_city'.camelize(:lower)).to eq('capitalCity')
  end

  it 'camelizes upper' do
    expect('capital_city'.camelize(:upper)).to eq('CapitalCity')
  end

  it 'camelizes upper default' do
    expect('capital_city'.camelize).to eq('CapitalCity')
  end

  UnderscoreToLowerCamel.each do |underscored, lower_camel|
    it 'camelizes lower' do
      expect(underscored.camelize(:lower)).to eq(lower_camel)
    end
  end

  UnderscoresToDashes.each do |underscored, dasherized|
    it 'dasherizes' do
      expect(underscored.dasherize).to eq(dasherized)
    end
  end

  CamelToUnderscore.each do |camel, underscore|
    it 'underscores' do
      expect(camel.underscore).to eq(underscore)
    end
  end

  it 'underscores acronyms' do
    expect('HTMLTidy'.underscore).to eq('html_tidy')
    expect('HTMLTidyGenerator'.underscore).to eq('html_tidy_generator')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
volt-0.8.27.beta6 spec/extra_core/string_transformations_spec.rb
volt-0.8.27.beta5 spec/extra_core/string_transformations_spec.rb
volt-0.8.27.beta4 spec/extra_core/string_transformations_spec.rb
volt-0.8.27.beta3 spec/extra_core/string_transformations_spec.rb