Last active
December 18, 2015 16:59
-
-
Save dabit/5815813 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Inflector | |
def self.pluralize(singular) | |
(singular == "country") ? "countries" : "#{singular}s" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
super LOL (singular == "country") ? "countries" : "#{singular}s