Sha256: afcad3a56c9f723e5c9a85ce6375336c5c01fe9a2459567a21f98fce9f16b5a5

Contents?: true

Size: 981 Bytes

Versions: 14

Compression:

Stored size: 981 Bytes

Contents

require "spec_helper"

describe "Plural cache" do
  it "caches pluralizations" do
    cache = Paperclip::Interpolations::PluralCache.new
    symbol = :box

    first = cache.pluralize_symbol(symbol)
    second = cache.pluralize_symbol(symbol)
    expect(first).to equal(second)
  end

  it "caches pluralizations and underscores" do
    class BigBox; end
    cache = Paperclip::Interpolations::PluralCache.new
    klass = BigBox

    first = cache.underscore_and_pluralize_class(klass)
    second = cache.underscore_and_pluralize_class(klass)
    expect(first).to equal(second)
  end

  it "pluralizes words" do
    cache = Paperclip::Interpolations::PluralCache.new
    symbol = :box

    expect(cache.pluralize_symbol(symbol)).to eq("boxes")
  end

  it "pluralizes and underscore class names" do
    class BigBox; end
    cache = Paperclip::Interpolations::PluralCache.new
    klass = BigBox

    expect(cache.underscore_and_pluralize_class(klass)).to eq("big_boxes")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kt-paperclip-7.2.2 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.2.1 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.2.0 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.4.2 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.1.1 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.1.0 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.0.1 spec/paperclip/plural_cache_spec.rb
kt-paperclip-7.0.0 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.4.1 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.4.0 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.3.0 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.2.2 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.2.1 spec/paperclip/plural_cache_spec.rb
kt-paperclip-6.2.0 spec/paperclip/plural_cache_spec.rb