Sha256: 2463e7f49f8db49fd7ea0c454e0c3a7322cdce1619be7794629839a6a3857f3d

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

#encoding: UTF-8
require 'spec_helper'

describe Termit::SpeechSynthesizer do
  describe "call" do
    before do
      response = double 'fake_response', body: :binary_sound_file
      fetcher = double 'fake_fetcher', data: response
      handler = double 'fake_sound_handler', call: :nothing
      Termit::DataFetcher.stub(:new) { fetcher }
      Termit::SoundResponseHandler.stub(:new) { handler }
    end

    context "system has mpg123 installed" do
      it "executes correct service objects" do
        Termit::SpeechSynthesizer.any_instance.stub(:check_sound_player) { nil }
        Termit::SoundResponseHandler.should_receive(:new).with(:binary_sound_file)
        Termit::SpeechSynthesizer.new(target_lang: :en, text: 'your mother', voice: true).call
      end
    end

    context "there is no mpq123 installed" do
      before do
        Object.any_instance.stub(:system) { nil }
      end
      it "executes correct service objects" do
        Termit::OutputManager.any_instance.should_receive(:display_player_error_and_quit)
        Termit::SpeechSynthesizer.new(target_lang: :en, text: 'your mother', voice: true).call
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
termit-2.10.1 spec/termit/speech_synthesizer_spec.rb
termit-2.10.0 spec/termit/speech_synthesizer_spec.rb
termit-2.0.9 spec/termit/speech_synthesizer_spec.rb
termit-2.0.8 spec/termit/speech_synthesizer_spec.rb
termit-2.0.7 spec/termit/speech_synthesizer_spec.rb
termit-2.0.6 spec/termit/speech_synthesizer_spec.rb