|
6 | 6 | expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id"))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"></Transfer></Response>") |
7 | 7 | end |
8 | 8 | it 'should allow to embed SpeakSentence' do |
9 | | - expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :speak_sentence => {:voice => "kate", :sentence => "text"}))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><SpeakSentence voice=\"kate\">text</SpeakSentence></Transfer></Response>") |
10 | | - expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :speak_sentence => SpeakSentence.new({:voice => "kate", :sentence => "text"})))).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><SpeakSentence voice=\"kate\">text</SpeakSentence></Transfer></Response>") |
| 9 | + result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><SpeakSentence voice=\"kate\" gender=\"female\">text</SpeakSentence></Transfer></Response>" |
| 10 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :speak_sentence => {:voice => "kate", :sentence => "text"}))).to eql(result) |
| 11 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :speak_sentence => SpeakSentence.new({:voice => "kate", :sentence => "text"})))).to eql(result) |
| 12 | + end |
| 13 | + it 'should allow to embed PlayAudio' do |
| 14 | + result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><PlayAudio>url1</PlayAudio></Transfer></Response>" |
| 15 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :play_audio => {:url =>"url1"}))).to eql(result) |
| 16 | + end |
| 17 | + it 'should allow to embed Record' do |
| 18 | + result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><Record requestUrl=\"url1\"/></Transfer></Response>" |
| 19 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :record => {:request_url =>"url1"}))).to eql(result) |
| 20 | + end |
| 21 | + it 'should allow to embed phone numbers' do |
| 22 | + result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><PhoneNumber>+1234568901</PhoneNumber><PhoneNumber>+1234568902</PhoneNumber></Transfer></Response>" |
| 23 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :phone_numbers => ["+1234568901", "+1234568902"]))).to eql(result) |
| 24 | + result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferTo=\"to\" transferCallerId=\"id\"><PhoneNumber>+1234568901</PhoneNumber></Transfer></Response>" |
| 25 | + expect(Helper.to_xml(Transfer.new(:to => "to", :caller_id => "id", :phone_number => "+1234568901"))).to eql(result) |
11 | 26 | end |
12 | 27 | end |
13 | 28 | end |
|
0 commit comments