|
1 | 1 | # Unit tests for Bandwidth::Bxml::Response |
2 | 2 | describe 'Bandwidth::Bxml::Response' do |
3 | 3 | let(:instance) { Bandwidth::Bxml::Response.new } |
| 4 | + let(:pause_recording) { Bandwidth::Bxml::PauseRecording.new } |
4 | 5 |
|
5 | 6 | describe 'test an instance of Response' do |
6 | 7 | it 'validates instance of Response' do |
7 | 8 | expect(instance).to be_instance_of(Bandwidth::Bxml::Response) |
8 | 9 | expect(instance).to be_a(Bandwidth::Bxml::Root) |
9 | 10 | end |
10 | 11 |
|
| 12 | + it 'test initializing with a single nested verb' do |
| 13 | + instance = Bandwidth::Bxml::Response.new(pause_recording) |
| 14 | + expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n" |
| 15 | + expect(instance.to_bxml).to eq(expected) |
| 16 | + end |
| 17 | + |
| 18 | + it 'test initializing with multiple nested verbs' do |
| 19 | + instance = Bandwidth::Bxml::Response.new([pause_recording, pause_recording]) |
| 20 | + expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n" |
| 21 | + expect(instance.to_bxml).to eq(expected) |
| 22 | + end |
| 23 | + |
| 24 | + it 'test adding a single verb to the Response instance' do |
| 25 | + instance.add_verbs(pause_recording) |
| 26 | + expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n" |
| 27 | + expect(instance.to_bxml).to eq(expected) |
| 28 | + end |
| 29 | + |
| 30 | + it 'test adding multiple verbs to the Response instance' do |
| 31 | + instance.add_verbs([pause_recording, pause_recording]) |
| 32 | + expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n" |
| 33 | + expect(instance.to_bxml).to eq(expected) |
| 34 | + end |
| 35 | + |
11 | 36 | it 'test the to_bxml method of the Response instance' do |
12 | 37 | expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response/>\n" |
13 | 38 | expect(instance.to_bxml).to eq(expected) |
|
0 commit comments