Sha256: 88cb12fbca85076a8358f58d03dcb7362e029099031cf019db8d8ef5aeb1e5d6

Contents?: true

Size: 729 Bytes

Versions: 11

Compression:

Stored size: 729 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
      expect(table.fetch(:a)).to eq("b")
      fetch = lambda { table.fetch(:z) }

      if RUBY_VERSION > "1.8.7"
        expect(fetch).to raise_error(KeyError)
      else
        expect(fetch).to 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")
      expect(table.fetch(:e)).to eq("f")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twitter_cldr-3.1.1 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.1.0 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.10 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.9 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.8 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.7 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.6 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.5 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.4 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.3 spec/parsers/symbol_table_spec.rb
twitter_cldr-3.0.2 spec/parsers/symbol_table_spec.rb