-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port number_with_delimiter method from ActiveSupport
https://github.com/rails/rails/blob/cfb1e4dfd8813d3d5c75a15a750b3c53eebdea65/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb crystal-lang/crystal#5573
- Loading branch information
Showing
2 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require "./spec_helper" | ||
|
||
class ClassWithWebHelpers | ||
include Sidekiq::WebHelpers | ||
end | ||
|
||
describe Sidekiq::WebHelpers do | ||
describe "#number_with_delimiter" do | ||
it "returns formatted number with delimiter" do | ||
klass = ClassWithWebHelpers.new | ||
|
||
klass.number_with_delimiter(1).should eq "1" | ||
klass.number_with_delimiter(123).should eq "123" | ||
klass.number_with_delimiter(1234).should eq "1,234" | ||
klass.number_with_delimiter(12345).should eq "12,345" | ||
klass.number_with_delimiter(123456).should eq "123,456" | ||
klass.number_with_delimiter(1234567).should eq "1,234,567" | ||
klass.number_with_delimiter(12345678).should eq "12,345,678" | ||
klass.number_with_delimiter(123456789).should eq "123,456,789" | ||
end | ||
end | ||
end |
This file contains 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