Sha256: f0fd5145d0588c6e2e1d2999b88adaddb6d786cce50c085075d65755b2304172

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

require File.join(File.dirname(__FILE__) + "/spec_helper")

describe Google::Translate do
  
  before(:each) do
    @gt = Google::Translate
  end
  
  it "should return a string" do
    expect_to_make_get_request
    r = @gt.to_french("Hello")
    
    r.should be_a_kind_of(String)
    r.should == "translated phrase"
  end
    
  it "should raise when no phrase passed" do
    lambda {
      @gt.english_to_french
    }.should raise_error(Google::Translate::NoPhrasePassed)
  end
  
  it "should raise with invalid from language passed" do
    lambda {
      @gt.klingon_to_english("Hello")
    }.should raise_error(Google::Translate::InvalidLanguage)
  end
  
  def expect_to_make_get_request
    @gt.should_receive(:get_translation).and_return("translated phrase")
  end  
end

describe Google::Tr do
  it "should match Google::Translate" do
    Google::Tr.should == Google::Translate
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caius-gtranslate-0.9.1 spec/gtranslate_spec.rb