Sha256: 9ef12b53a9cdddd6afb6cdf055824c4bab2bb1dce23e031bdff461b4934fc2bb

Contents?: true

Size: 980 Bytes

Versions: 5

Compression:

Stored size: 980 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 = "https://translate.google.com/translate_a/single?client=t&sl=en&tl=fr&hl=pl&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=1&ssel=3&tsel=6&kc=2&tk=522578"

        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 = "https://translate.google.com/translate_tts?ie=UTF-8&tl=fr&total=1&idx=0&textlen=5&tk=735012&client=t"
        expect(url_formatter.url).to eq(url)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
termit-2.13.0 spec/termit/url_constructor_spec.rb
termit-2.12.1 spec/termit/url_constructor_spec.rb
termit-2.12.0 spec/termit/url_constructor_spec.rb
termit-2.11.2 spec/termit/url_constructor_spec.rb
termit-2.11.1 spec/termit/url_constructor_spec.rb