Sha256: 2cf5d88b671f96a107c26aa3c61f2d3aa89bf7535bbd467ba3d83590607bab0e

Contents?: true

Size: 1.42 KB

Versions: 35

Compression:

Stored size: 1.42 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

describe '#headerize' do
  it 'headerizes' do
    expect('test_case'.headerize).to eq('Test-Case')
  end

  UnderscoresToHeaders.each do |underscored, headerized|
    it 'underscores' do
      expect(underscored.headerize).to eq(headerized)
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/extra_core/string_transformations_spec.rb
volt-0.9.7.pre7 spec/extra_core/string_transformations_spec.rb
volt-0.9.7.pre6 spec/extra_core/string_transformations_spec.rb
volt-0.9.7.pre5 spec/extra_core/string_transformations_spec.rb
volt-0.9.7.pre3 spec/extra_core/string_transformations_spec.rb
volt-0.9.7.pre2 spec/extra_core/string_transformations_spec.rb
volt-0.9.6 spec/extra_core/string_transformations_spec.rb
volt-0.9.6.pre3 spec/extra_core/string_transformations_spec.rb
volt-0.9.6.pre2 spec/extra_core/string_transformations_spec.rb
volt-0.9.6.pre1 spec/extra_core/string_transformations_spec.rb
volt-0.9.5 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre12 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre11 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre9 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre8 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre7 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre6 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre5 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre4 spec/extra_core/string_transformations_spec.rb
volt-0.9.5.pre3 spec/extra_core/string_transformations_spec.rb