Sha256: 3dfcaabf252bc8726d655ef072c7429314294a42e0777bf75abc71abdf5e7ab1
Contents?: true
Size: 819 Bytes
Versions: 17
Compression:
Stored size: 819 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' include TwitterCldr::Formatters::Numbers include TwitterCldr::Tokenizers describe Fraction do describe "#apply" do it "test: formats a fraction" do token = Token.new(:value => '###.##', :type => :pattern) expect(Fraction.new(token).apply('45')).to eq('.45') end it "test: pads zero digits on the right side" do token = Token.new(:value => '###.0000#', :type => :pattern) expect(Fraction.new(token).apply('45')).to eq('.45000') end it "test: :precision option overrides format precision" do token = Token.new(:value => '###.##', :type => :pattern) expect(Fraction.new(token).apply('78901', :precision => 5)).to eq('.78901') end end end
Version data entries
17 entries across 17 versions & 2 rubygems