Sha256: 3204ebbba50cfbe851bc3b2d5b1950fe903340145843f3e4d7387f0d7b5643ee

Contents?: true

Size: 995 Bytes

Versions: 4

Compression:

Stored size: 995 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))

describe 'String#numericise' do
  describe 'when given nil' do
    it 'should begin with "no"' do
      'word'.numericise(nil).should =~ /^no/
    end

    it 'should pluralise the word' do
      'word'.numericise(nil).should =~ /words$/
    end
  end

  describe 'when given 0' do
    it 'should begin with "no"' do
      'word'.numericise(0).should =~ /^no/
    end

    it 'should pluralise the word' do
      'word'.numericise(0).should =~ /words$/
    end
  end

  describe 'when given 1' do
    it 'should begin with "one"' do
      'word'.numericise(1).should =~ /^one/
    end

    it 'should not pluralise the word' do
      'word'.numericise(1).should =~ /word$/
    end
  end

  describe 'when given > 1' do
    it 'should begin with the number' do
      'word'.numericise(2).should =~ /^2/
    end

    it 'should pluralise the word' do
      'word'.numericise(2).should =~ /words$/
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
antw-kin-0.3.2 spec/core_ext/string_spec.rb
antw-kin-0.3.3 spec/core_ext/string_spec.rb
antw-kin-0.4.0 spec/core_ext/string_spec.rb
antw-kin-0.4.1 spec/core_ext/string_spec.rb