Sha256: 713b3f31594761c4c3aa6f0c21fe1e37af57323bc77567544582ae8121feea21

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Parsers

describe SymbolTable do
  let(:table) { SymbolTable.new(:a => "b", :c => "d") }

  describe "#fetch" do
    it "should be able to retrieve values for symbols" do
      table.fetch(:a).should == "b"
      fetch = lambda { table.fetch(:z) }

      if RUBY_VERSION > "1.8.7"
        fetch.should raise_error(KeyError)
      else
        fetch.should raise_error(IndexError)
      end
    end
  end

  describe "#add" do
    it "should be able to add then fetch new values for symbols" do
      table.add(:e, "f")
      table.fetch(:e).should == "f"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter_cldr-3.0.1 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.0 spec/parsers/symbol_table_spec.rb