Sha256: e176c2777364e29ad745052f83b54b0e23ae4cadca684aa39d95dd3d69695025
Contents?: true
Size: 1.03 KB
Versions: 16
Compression:
Stored size: 1.03 KB
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' include TwitterCldr::Formatters describe DecimalFormatter do before(:each) do @formatter = DecimalFormatter.new(:locale => :nl) end describe "#format" do it "should format positive decimals correctly" do @formatter.format(12.0).should == "12,0" end it "should format negative decimals correctly" do @formatter.format(-12.0).should == "-12,0" end it "should respect the :precision option" do @formatter.format(-12, :precision => 3).should == "-12,000" end end describe "#get_tokens" do it "should ask the tokenizer for the tokens for a positive number" do mock(@formatter.tokenizer).tokens(:sign => :positive) { true } @formatter.send(:get_tokens, 12) end it "should ask the tokenizer for the tokens for a negative number" do mock(@formatter.tokenizer).tokens(:sign => :negative) { true } @formatter.send(:get_tokens, -12) end end end
Version data entries
16 entries across 16 versions & 1 rubygems