Sha256: 6f60f14f3b0e87ceaef091acb88d71828cb483baa782616e6553e561e92cc2a8

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Shared

describe Territory do
  let(:code) { '013' }
  let(:territory) { Territory.new(code) }

  describe '#parents' do
    let(:parents) { %w[013 territory parents] }

    it 'delegates to TerritoriesContainment.parents' do
      mock(TerritoriesContainment).parents(code) { parents }
      expect(territory.parents).to eq(parents)
    end
  end

  describe '#children' do
    let(:children) { %w[013 territory children] }

    it 'delegates to TerritoriesContainment.children' do
      mock(TerritoriesContainment).children(code) { children }
      expect(territory.children).to eq(children)
    end
  end

  describe '#contains?' do
    let(:other_code) { 'RU' }
    let(:result) { 'containment result' }

    it 'delegates to TerritoriesContainment.contains?' do
      mock(TerritoriesContainment).contains?(code, other_code) { result }
      expect(territory.contains?(other_code)).to be_true
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
twitter_cldr-3.0.7 spec/shared/territory_spec.rb