Sha256: 5215bfd401fbbd1df1a0f01e3a6a2b5c0c114c07287a72533d062fe4fd330998

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Tokenizers

describe TimespanTokenizer do

  describe "#tokens" do
    it "should return the correct list of tokens" do
      tokenizer = TimespanTokenizer.new(nil)
      tokenizer.tokenize("Hace {0} minutos").tap do |tokens|
        tokens[0].tap do |token|
          token.value.should == "Hace "
          token.type.should == :plaintext
        end

        tokens[1].tap do |token|
          token.value.should == "{0}"
          token.type.should == :pattern
        end

        tokens[2].tap do |token|
          token.value.should == " minutos"
          token.type.should == :plaintext
        end
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter_cldr-3.0.1 spec/tokenizers/calendars/timespan_tokenizer_spec.rb
twitter_cldr-3.0.0 spec/tokenizers/calendars/timespan_tokenizer_spec.rb