Sha256: 3c153dde3fca1fae4ee261576799a491ff7a99dc4ba5cdd4f3ee827ad1dac2e5

Contents?: true

Size: 931 Bytes

Versions: 10

Compression:

Stored size: 931 Bytes

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
  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

10 entries across 10 versions & 1 rubygems

Version Path
twitter_cldr-1.6.2 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.6.1 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.6.0 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.5.0 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.4.1 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.4.0 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.3.6 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.3.0 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.2.0 spec/formatters/numbers/decimal_formatter_spec.rb
twitter_cldr-1.1.0 spec/formatters/numbers/decimal_formatter_spec.rb