Sha256: efcaf9f28cb4fcc79f9860a491203dbe0fe0d797cdb84ed463a99b3b166ba27c
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require "./test/tests_helper" require "nele" describe "BabelfishTranslator" do def setup String.translator = :babelfish String.translator.config[:url] = "url" String.translator.config[:lp] = "es_en" end def subject String.translator end describe("#build_request") do def str 'hello' end it("invokes /parse_uri/ method") do subject.expects(:parse_uri).with(subject.config[:url]).once subject.build_request(str) end it("invokes /create_post_form/ method") do subject.expects(:create_post_form).with(str).once subject.build_request(str) end end describe("#parse_response") do it("returns proper translation") do html_element = "<div id=\"result\">"\ "<div style=\"padding:0.6em;\">hola</div></div>" mock = mock(:body => html_element) subject.parse_response(mock).must_equal "hola" end it("raises exception when tag is not found") do mock = mock(:body => "some content") lambda { subject.parse_response(mock) }.must_raise(Nele::TranslatorAPIError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nele-0.2.2 | test/babelfish_translator_test.rb |