Skip to content

Instantly share code, notes, and snippets.

@dabit
Last active December 18, 2015 16:59
Show Gist options
  • Save dabit/5815813 to your computer and use it in GitHub Desktop.
Save dabit/5815813 to your computer and use it in GitHub Desktop.
class Inflector
def self.pluralize(singular)
(singular == "country") ? "countries" : "#{singular}s"
end
end
describe Inflector do
describe ".pluralize" do
it "appends an s to the end of the specified singular" do
Inflector.pluralize("cat").should == "cats"
end
it "pluralizes country" do
Spree::Inflector.pluralize("country").should == "countries"
end
end
end
@hecbuma
Copy link

hecbuma commented Jun 20, 2013

super LOL (singular == "country") ? "countries" : "#{singular}s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment