class TestEspeak
Test of espeak marshaller.
Public Instance Methods
setup()
click to toggle source
# File lib/belphanior/servant/speech/test/tc_espeak.rb, line 9 def setup @syscall_mock = mock() @adaptor = Belphanior::Servant::Speech::Adaptors::Espeak.new(@syscall_mock) end
test_error_handling()
click to toggle source
# File lib/belphanior/servant/speech/test/tc_espeak.rb, line 24 def test_error_handling @syscall_mock.expects(:system).with('espeak "this will crash"').returns(false) @syscall_mock.expects(:system).with('espeak "nil return"').returns(nil) assert_raise(Belphanior::Servant::Speech::Adaptors::Espeak::Exception) { @adaptor.say("this will crash") } assert_raise(Belphanior::Servant::Speech::Adaptors::Espeak::Exception) { @adaptor.say("nil return") } end
test_text()
click to toggle source
# File lib/belphanior/servant/speech/test/tc_espeak.rb, line 14 def test_text @syscall_mock.expects(:system).with('espeak "Hello, world!"').returns(true) assert_nil(@adaptor.say("Hello, world!")) end
test_text_with_voice()
click to toggle source
# File lib/belphanior/servant/speech/test/tc_espeak.rb, line 19 def test_text_with_voice @syscall_mock.expects(:system).with('espeak -v "Fred" "Test Message"').returns(true) assert_nil(@adaptor.say("Test Message", :voice=>"Fred")) end