Sha256: 25e498966eabda427df1abd7bba365c628ac85cb25c45ef7b1e819c070c7737e

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

require 'spec_helper'

describe Dolarblue::Inflector do

  subject { Dolarblue::Inflector }

  it 'demodulizes simple 1-level unnested classes' do
    expect(subject.demodulize('Account')).to eq('Account')
    expect(subject.demodulize('Inflections')).to eq('Inflections')
  end

  it 'demodulizes larger 3-levels nested classes' do
    expect(subject.demodulize('MyApplication::Billing::Account')).to eq('Account')
  end

  it 'demodulizes 2-levels nested classes' do
    expect(subject.demodulize('Dolarblue::Card')).to eq('Card')
  end

  it 'demodulizes larger 4-levels nested classes' do
    expect(subject.demodulize('ActiveRecord::CoreExtensions::String::Inflections')).to eq('Inflections')
  end

  it 'demodulizes empty unnested string' do
    expect(subject.demodulize('')).to eq('')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dolarblue-0.5.2 spec/inflector_spec.rb
dolarblue-0.5.1 spec/inflector_spec.rb
dolarblue-0.5.0 spec/inflector_spec.rb