Sha256: b49fa0144ad0094c0c27d201f988aa32b4dee59a98bc5c57ca098d26e8f10e05

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# encoding: UTF-8

require File.join(File.dirname(File.dirname(__FILE__)), "spec_helper")
include TwitterCldr::Tokenizers

describe KeyPath do
  describe "#dirname" do
    it "should strip off the last element" do
      KeyPath.dirname("castle.in.the.sky").should == "castle.in.the"
    end

    it "shouldn't choke if given an empty string" do
      KeyPath.dirname("").should == ""
    end
  end

  describe "#join" do
    it "joins two args with two dots" do
      KeyPath.join("seahawks.", ".rule").should == "seahawks.rule"
    end

    it "joins two args with one dot at the end of the first" do
      KeyPath.join("seahawks.", "rule").should == "seahawks.rule"
    end

    it "joins two args with one dot at the beginning of the second" do
      KeyPath.join("seahawks", ".rule").should == "seahawks.rule"
    end

    it "joins two args with no dots" do
      KeyPath.join("seahawks", "rule").should == "seahawks.rule"
    end
  end

  describe "#split_path" do
    it "should split the path by dots" do
      KeyPath.split_path("rain.in.spain").should == ["rain", "in", "spain"]
    end
  end

  describe "#join_path" do
    it "should join the path with dots" do
      KeyPath.join_path(["rain", "in", "spain"]).should == "rain.in.spain"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.1 spec/tokenizers/key_path_spec.rb