File: tabelize_spec.rb

package info (click to toggle)
ruby-inflecto 0.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 236 kB
  • sloc: ruby: 691; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

describe Inflecto, '.tableize' do
  it 'pluralizes last word in snake_case strings: fancy_category => fancy_categories' do
    Inflecto.tableize('fancy_category').should == 'fancy_categories'
  end

  it 'underscores CamelCase strings before pluralization: enlarged_testis => enlarged_testes' do
    Inflecto.tableize('enlarged_testis').should == 'enlarged_testes'
  end

  it 'underscores CamelCase strings before pluralization: FancyCategory => fancy_categories' do
    Inflecto.tableize('FancyCategory').should == 'fancy_categories'
  end

  it 'underscores CamelCase strings before pluralization: EnlargedTestis => enlarged_testes' do
    Inflecto.tableize('EnlargedTestis').should == 'enlarged_testes'
  end

  it 'replaces :: with underscores: Fancy::Category => fancy_categories' do
    Inflecto.tableize('Fancy::Category').should == 'fancy_categories'
  end

  it 'underscores CamelCase strings before pluralization: Enlarged::Testis => enlarged_testes' do
    Inflecto.tableize('Enlarged::Testis').should == 'enlarged_testes'
  end
end