Sha256: 5812e7d029ae55c8d7f3180eb19645742064b92ea16b937c5caf5e37da6cdffc

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

#encoding: utf-8
require "spec_helper"

describe YoudaoFanyi::Translator do

  before {
    YoudaoFanyi::Configuration.api_keys = YOUDAO_FANYI_API_KEYS
    YoudaoFanyi.reload!
  }

  it "should has translate" do
    YoudaoFanyi::Translator.should respond_to(:translate)
  end

  it "translate return a instance of YoudaoFanyi::Connector" do
    YoudaoFanyi::Translator.translate(:china).first.should be_instance_of(YoudaoFanyi::Connector)
  end

  it "!translate return a instance of self" do
    YoudaoFanyi::Translator.translate(:china, :not_translate => true).should be_instance_of(YoudaoFanyi::Translator)
  end

  it "translate special word" do
    translator = YoudaoFanyi::Translator.translate(nil, true, false, "", :not_translate => true)
    translator.queries.should == ['nil', 'true', 'false', 'nil']
  end

  it "should has t" do
    YoudaoFanyi::Translator.should respond_to(:t)
  end

  it "only return translation when use t()" do
    YoudaoFanyi::Translator.t(:china).should == ["中国"]
    YoudaoFanyi::Translator.t(:china, :i).should == ["中国", "我"]
  end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
youdao_fanyi-0.1.2.2 spec/youdao_fanyi/translator_spec.rb
youdao_fanyi-0.1.2.1 spec/youdao_fanyi/translator_spec.rb
youdao_fanyi-0.1.2 spec/youdao_fanyi/translator_spec.rb
youdao_fanyi-0.1.1 spec/youdao_fanyi/translator_spec.rb
youdao_fanyi-0.1.0 spec/youdao_fanyi/translator_spec.rb