Sha256: 454b83082fc7bb4df9119bfdfc977ddbcd8a8653c49c1c8afc52d67777799e60

Contents?: true

Size: 957 Bytes

Versions: 10

Compression:

Stored size: 957 Bytes

Contents

require './test/helper'

class PluralCacheTest < Test::Unit::TestCase
  should 'cache pluralizations' do
    cache = Paperclip::Interpolations::PluralCache.new
    word = "box"

    word.expects(:pluralize).returns("boxes").once

    cache.pluralize(word)
    cache.pluralize(word)
  end

  should 'cache pluralizations and underscores' do
    cache = Paperclip::Interpolations::PluralCache.new
    word = "BigBox"

    word.expects(:pluralize).returns(word).once
    word.expects(:underscore).returns(word).once

    cache.underscore_and_pluralize(word)
    cache.underscore_and_pluralize(word)
  end

  should 'pluralize words' do
    cache = Paperclip::Interpolations::PluralCache.new
    word = "box"
    assert_equal "boxes", cache.pluralize(word)
  end

  should 'pluralize and underscore words' do
    cache = Paperclip::Interpolations::PluralCache.new
    word = "BigBox"
    assert_equal "big_boxes", cache.underscore_and_pluralize(word)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
paperclip-4.1.1 test/plural_cache_test.rb
paperclip-4.1.0 test/plural_cache_test.rb
paperclip-3.5.4 test/plural_cache_test.rb
paperclip-4.0.0 test/plural_cache_test.rb
paperclip-3.5.3 test/plural_cache_test.rb
paperclip-3.5.2 test/plural_cache_test.rb
paperclip-3.5.1 test/plural_cache_test.rb
paperclip-3.5.0 test/plural_cache_test.rb
paperclip-3.4.2 test/plural_cache_test.rb
paperclip-3.4.1 test/plural_cache_test.rb