Sha256: 39f5baee235f64ecd7648c7ad990298ee6d457c65ebdbe9a2b3d21e8f18ca395

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

#encoding: UTF-8
require 'spec_helper'

describe Termit::UrlConstructor do
  describe "url method" do
    context "when talk flag is set to false" do
      it "returns correctly formatted url" do
        url_formatter = Termit::UrlConstructor.new  source_lang: :en, target_lang: :fr, text: 'your mother', talk: false
        url = "http://translate.google.com/translate_a/t?client=t&sl=en&tl=fr&hl=pl&sc=2&ie=UTF-8&oe=UTF-8&prev=enter&ssel=0&tsel=0&"

        expect(url_formatter.url).to eq(url)
      end
    end

    context "when talk flag is set to true" do
      it "returns correctly formatted url" do
        url_formatter = Termit::UrlConstructor.new  target_lang: :fr, text: 'your mother', talk: true
        url = "http://translate.google.com/translate_tts?tl=fr&ie=UTF-8&oe=UTF-8"
        expect(url_formatter.url).to eq(url)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
termit-2.10.2 spec/termit/url_constructor_spec.rb
termit-2.10.1 spec/termit/url_constructor_spec.rb
termit-2.10.0 spec/termit/url_constructor_spec.rb
termit-2.0.9 spec/termit/url_constructor_spec.rb