Class: TestEspeak
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestEspeak
- Defined in:
- lib/belphanior/servant/speech/test/tc_espeak.rb
Overview
Test of espeak marshaller.
Instance Method Summary collapse
Instance Method Details
#setup ⇒ Object
9 10 11 12 |
# 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 ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# 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 ⇒ Object
14 15 16 17 |
# 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 ⇒ Object
19 20 21 22 |
# 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 |