Sha256: 3a99b97a11f5c5bb78363ce01a18ff5bb4fd0d24f6f823c22a6b086d57cf7e0d

Contents?: true

Size: 1.13 KB

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
termit-2.13.0 spec/termit/speech_synthesizer_spec.rb
termit-2.12.1 spec/termit/speech_synthesizer_spec.rb
termit-2.12.0 spec/termit/speech_synthesizer_spec.rb
termit-2.11.2 spec/termit/speech_synthesizer_spec.rb
termit-2.11.1 spec/termit/speech_synthesizer_spec.rb
termit-2.11.0 spec/termit/speech_synthesizer_spec.rb
termit-2.10.2 spec/termit/speech_synthesizer_spec.rb