Sha256: 53e73afe68cf85586a189b893c892db2a6ccacc483169a8b4f776be0d6438456

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'spec_helper'

include TwitterCldr::Formatters

describe TimespanFormatter do

  describe "#format" do
    let(:formatter) { TimespanFormatter.new(:locale => :de) }

    describe "#ago" do
      it "works for a variety of units" do
        formatter.format(-3273932, :year).should == 'Vor 0 Jahren'
        formatter.format(-3273932, :month).should == 'Vor 1 Monat'
        formatter.format(-3273932, :week).should == 'Vor 5 Wochen'
        formatter.format(-3273932, :day).should == 'Vor 37 Tagen'
        formatter.format(-3273932, :hour).should == 'Vor 909 Stunden'
        formatter.format(-3273932, :minute).should == 'Vor 54565 Minuten'
        formatter.format(-3273932, :second).should == 'Vor 3273932 Sekunden'
      end
    end

    describe "#until" do
      it "works for a variety of units" do
        formatter.format(3273932, :year).should == 'In 0 Jahren'
        formatter.format(3273932, :month).should == 'In 1 Monat'
        formatter.format(3273932, :week).should == 'In 5 Wochen'
        formatter.format(3273932, :day).should == 'In 37 Tagen'
        formatter.format(3273932, :hour).should == 'In 909 Stunden'
        formatter.format(3273932, :minute).should == 'In 54565 Minuten'
        formatter.format(3273932, :second).should == 'In 3273932 Sekunden'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter_cldr-1.5.0 spec/formatters/calendars/timespan_formatter_spec.rb
twitter_cldr-1.4.1 spec/formatters/calendars/timespan_formatter_spec.rb
twitter_cldr-1.4.0 spec/formatters/calendars/timespan_formatter_spec.rb
twitter_cldr-1.3.6 spec/formatters/calendars/timespan_formatter_spec.rb