Sha256: 653f3fc0d87bbee68dcc0a2868b9a8daae64d900f6dd93b25d2f44ccbaf8acf3

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

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.0 spec/tokenizers/key_path_spec.rb