Sha256: fb6e908c5500f3bd921171358b8b18c6bf19b708dcdb292eff4d789186eadc75

Contents?: true

Size: 868 Bytes

Versions: 13

Compression:

Stored size: 868 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://www.bing.com/translator/api/Translate/TranslateArray?from=en&to=fr"

        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://www.bing.com/translator/api/language/Speak?locale=fr-FR&gender=male&media=audio/mp3&text=your%20mother"
        expect(url_formatter.url).to eq(url)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
termit-3.9.0 spec/termit/url_constructor_spec.rb
termit-3.8.0 spec/termit/url_constructor_spec.rb
termit-3.7.0 spec/termit/url_constructor_spec.rb
termit-3.6.0 spec/termit/url_constructor_spec.rb
termit-3.5.0 spec/termit/url_constructor_spec.rb
termit-3.4.0 spec/termit/url_constructor_spec.rb
termit-3.2.0 spec/termit/url_constructor_spec.rb
termit-3.1.2 spec/termit/url_constructor_spec.rb
termit-3.1.1 spec/termit/url_constructor_spec.rb
termit-3.1.0 spec/termit/url_constructor_spec.rb
termit-3.0.2 spec/termit/url_constructor_spec.rb
termit-3.0.1 spec/termit/url_constructor_spec.rb
termit-3.0.0 spec/termit/url_constructor_spec.rb