Sha256: cc7b345bcc452de79cce217cc17de75045296a09154d2421bceb30c001a664e1

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# encoding: UTF-8
require "spec_helper"

describe CLD do

  context "English text" do
    subject { CLD.detect_language("This is a test") }

    it { subject[:name].should eq("ENGLISH") }
    it { subject[:code].should eq("en") }
    it { subject[:reliable].should be_true }
  end

  context "French text" do
    subject { CLD.detect_language("plus ça change, plus c'est la même chose") }

    it { subject[:name].should eq("FRENCH") } 
    it { subject[:code].should eq("fr") }
    it { subject[:reliable].should be_true }
  end
  
  context "Simplified Chinese text" do
    subject { CLD.detect_language("你好吗箭体") }

    it { subject[:name].should eq("Chinese") } 
    it { subject[:code].should eq("zh") }
  end
  
  context "Traditional Chinese text" do
    subject { CLD.detect_language("你好嗎繁體") }

    it { subject[:name].should eq("ChineseT") } 
    it { subject[:code].should eq("zh-TW") }
  end

  context "Unknown text" do
    subject { CLD.detect_language("") }

    it { subject[:name].should eq("Unknown") }
    it { subject[:code].should eq("un") }
    it { subject[:reliable].should be_true }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cld-0.5.0 spec/cld_spec.rb