Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Fix on Extlib::Inflection#singular #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/extlib/inflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def singular(word)
regex, hash = singularization_rules
result.sub!(regex) {|m| hash[m]}
singular_of[word] = result
return result
return result.dup
end

# Alias for #singular (a Railism).
Expand Down
6 changes: 6 additions & 0 deletions spec/inflection/singular_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,4 +499,10 @@
it "singularizes rice => rice" do
"rice".singular.should == "rice"
end

it "makes dup on result" do
(singular = "calls".singular).should == "call"
singular << "should_not_be_added_to_original"
"calls".singular.should == "call"
end
end