Sha256: df42ea2653fae03aa26e1eb45658c05eef25aa8846bda00438902918f6097acd

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

describe TwitterCldr::Tokenizers::CompositeToken do
  let(:token) { TwitterCldr::Tokenizers::Token }
  let(:composite_token) { TwitterCldr::Tokenizers::CompositeToken }

  describe "#initialize" do
    it "should set an array of tokens" do
      token_0 = token.new(type: "my_type_0", value: "my_value_0")
      token_1 = token.new(type: "my_type_1", value: "my_value_1")

      comp_token = composite_token.new([token_0, token_1])
      expect(comp_token.tokens.map { |t| t.type }).to eq(["my_type_0", "my_type_1"])
      expect(comp_token.tokens.map { |t| t.value }).to eq(["my_value_0", "my_value_1"])
  	end

    it "should return content" do
      token_0 = token.new(type: "my_type_0", value: "my_value_0")
      token_1 = token.new(type: "my_type_1", value: "my_value_1")

      comp_token = composite_token.new([token_0, token_1])
      expect(comp_token.to_s).to eq("my_value_0my_value_1")
  	end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
twitter_cldr-6.7.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.6.2 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.6.1 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.6.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.5.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.4.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.3.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.2.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.1.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.0.2 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.0.1 spec/tokenizers/composite_token_spec.rb
twitter_cldr-6.0.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-5.4.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-5.3.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-5.2.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-5.1.0 spec/tokenizers/composite_token_spec.rb
twitter_cldr-5.0.0 spec/tokenizers/composite_token_spec.rb