ruby_rabbitmq_janus 1.2.9 → 2.0.0.pre.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +145 -32
  4. data/config/default.yml +2 -0
  5. data/config/requests.md +2 -1
  6. data/config/requests/admin/add_token.json +6 -0
  7. data/config/requests/admin/allow_token.json +6 -0
  8. data/config/requests/admin/disallow_token.json +6 -0
  9. data/config/requests/admin/handle_info.json +1 -1
  10. data/config/requests/admin/handles.json +1 -1
  11. data/config/requests/admin/remove_token.json +6 -0
  12. data/config/requests/admin/sessions.json +1 -1
  13. data/config/requests/admin/set_locking_debug.json +6 -0
  14. data/config/requests/admin/{log_level.json → set_log_level.json} +1 -1
  15. data/config/requests/admin/tokens.json +5 -0
  16. data/config/requests/base/attach.json +1 -1
  17. data/config/requests/base/create.json +1 -1
  18. data/config/requests/base/destroy.json +1 -1
  19. data/config/requests/base/detach.json +1 -1
  20. data/config/requests/base/info.json +1 -1
  21. data/config/requests/base/keepalive.json +1 -1
  22. data/config/requests/peer/answer.json +1 -1
  23. data/config/requests/peer/offer.json +1 -1
  24. data/config/requests/peer/trickle.json +1 -1
  25. data/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +3 -0
  26. data/lib/rrj/admin.rb +34 -0
  27. data/lib/rrj/errors/error.rb +2 -1
  28. data/lib/rrj/errors/init.rb +6 -0
  29. data/lib/rrj/errors/janus/janus.rb +1 -0
  30. data/lib/rrj/errors/janus/janus_message.rb +8 -4
  31. data/lib/rrj/errors/janus/janus_processus_keepalive.rb +1 -0
  32. data/lib/rrj/errors/janus/janus_response.rb +27 -6
  33. data/lib/rrj/errors/janus/janus_transaction.rb +4 -0
  34. data/lib/rrj/errors/rabbit/rabbit.rb +3 -1
  35. data/lib/rrj/errors/tools/config.rb +1 -0
  36. data/lib/rrj/info.rb +1 -1
  37. data/lib/rrj/init.rb +37 -169
  38. data/lib/rrj/janus/messages/admin.rb +1 -2
  39. data/lib/rrj/janus/messages/message.rb +4 -4
  40. data/lib/rrj/janus/messages/standard.rb +3 -5
  41. data/lib/rrj/janus/processus/concurrency.rb +1 -1
  42. data/lib/rrj/janus/processus/keepalive.rb +10 -4
  43. data/lib/rrj/janus/responses/admin.rb +31 -0
  44. data/lib/rrj/janus/responses/event.rb +23 -5
  45. data/lib/rrj/janus/responses/response.rb +2 -0
  46. data/lib/rrj/janus/responses/standard.rb +26 -5
  47. data/lib/rrj/janus/transactions/admin.rb +22 -26
  48. data/lib/rrj/janus/transactions/handle.rb +13 -8
  49. data/lib/rrj/janus/transactions/session.rb +25 -7
  50. data/lib/rrj/janus/transactions/transaction.rb +2 -1
  51. data/lib/rrj/rabbit/connect.rb +2 -3
  52. data/lib/rrj/rabbit/publish/admin.rb +1 -6
  53. data/lib/rrj/rabbit/publish/base_publisher.rb +6 -11
  54. data/lib/rrj/rabbit/publish/exclusive.rb +1 -0
  55. data/lib/rrj/rabbit/publish/listener.rb +10 -27
  56. data/lib/rrj/rabbit/publish/non_exclusive.rb +2 -6
  57. data/lib/rrj/rabbit/publish/publisher.rb +4 -17
  58. data/lib/rrj/tools/{config.rb → gem/config.rb} +5 -5
  59. data/lib/rrj/tools/{log.rb → gem/log.rb} +21 -6
  60. data/lib/rrj/tools/gem/option.rb +57 -0
  61. data/lib/rrj/tools/{requests.rb → gem/requests.rb} +0 -0
  62. data/lib/rrj/tools/replaces/admin.rb +7 -13
  63. data/lib/rrj/tools/replaces/handle.rb +61 -0
  64. data/lib/rrj/tools/replaces/replace.rb +57 -27
  65. data/lib/rrj/tools/replaces/session.rb +34 -0
  66. data/lib/rrj/tools/replaces/type.rb +63 -11
  67. data/lib/rrj/tools/tools.rb +4 -3
  68. data/lib/ruby_rabbitmq_janus.rb +1 -0
  69. data/spec/request/admin/request_handle_info_spec.rb +13 -7
  70. data/spec/request/admin/request_handles_spec.rb +20 -0
  71. data/spec/request/admin/request_sessions_spec.rb +5 -4
  72. data/spec/request/admin/request_set_locking_debug_spec.rb +16 -0
  73. data/spec/request/admin/request_set_log_level_spec.rb +16 -0
  74. data/spec/request/admin/request_tokens_spec.rb +13 -0
  75. data/spec/request/base/request_attach_spec.rb +6 -9
  76. data/spec/request/base/request_create_spec.rb +5 -3
  77. data/spec/request/base/request_destroy_spec.rb +5 -3
  78. data/spec/request/base/request_detach_spec.rb +6 -7
  79. data/spec/request/base/request_info_spec.rb +5 -3
  80. data/spec/request/base/request_keepalive_spec.rb +5 -3
  81. data/spec/request/peer/request_offer_spec.rb +18 -92
  82. data/spec/request/peer/request_trickle_spec.rb +9 -28
  83. data/spec/request/peer/request_trickles_spec.rb +23 -0
  84. data/spec/rrj/responses/responses_admin_spec.rb +39 -0
  85. data/spec/rrj/responses/responses_event_spec.rb +25 -0
  86. data/spec/rrj/responses/responses_response_spec.rb +31 -0
  87. data/spec/rrj/responses/responses_standard_spec.rb +43 -0
  88. data/spec/rrj/rrj_config_spec.rb +7 -7
  89. data/spec/rrj/rrj_rabbitmq_spec.rb +1 -1
  90. data/spec/rrj/tools/replace_admin_spec.rb +86 -0
  91. data/spec/rrj/tools/replace_handle_spec.rb +78 -0
  92. data/spec/rrj/tools/replace_session_spec.rb +66 -0
  93. data/spec/rrj/tools/replace_spec.rb +69 -0
  94. data/spec/rrj/tools/type_spec.rb +150 -0
  95. data/spec/spec_helper.rb +46 -7
  96. data/spec/support/examples_request.rb +33 -61
  97. data/spec/support/examples_response.rb +30 -0
  98. data/spec/support/schemas/request/admin/handles.json +15 -0
  99. data/spec/support/schemas/request/admin/set_locking_debug.json +13 -0
  100. data/spec/support/schemas/request/admin/set_log_level.json +11 -0
  101. data/spec/support/schemas/request/admin/tokens.json +13 -0
  102. data/spec/support/type.rb +66 -0
  103. metadata +41 -69
  104. data/config/requests/peer/trickles.json +0 -7
  105. data/lib/rrj/tools/replaces/standard.rb +0 -101
  106. data/spec/fixtures/config/requests/admin/handle_info.json +0 -3
  107. data/spec/fixtures/config/requests/admin/handles.json +0 -3
  108. data/spec/fixtures/config/requests/admin/log_level.json +0 -3
  109. data/spec/fixtures/config/requests/admin/sessions.json +0 -3
  110. data/spec/fixtures/config/requests/base/attach.json +0 -3
  111. data/spec/fixtures/config/requests/base/create.json +0 -4
  112. data/spec/fixtures/config/requests/base/destroy.json +0 -3
  113. data/spec/fixtures/config/requests/base/detach.json +0 -3
  114. data/spec/fixtures/config/requests/base/info.json +0 -3
  115. data/spec/fixtures/config/requests/base/keepalive.json +0 -3
  116. data/spec/fixtures/config/requests/peer/answer.json +0 -3
  117. data/spec/fixtures/config/requests/peer/offer.json +0 -3
  118. data/spec/fixtures/config/requests/peer/trickle.json +0 -3
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type tokens list', broken: true do
6
+ before(:example) { @type = 'admin::tokens' }
7
+
8
+ describe '#start_transaction_admin', type: :request,
9
+ level: :admin,
10
+ name: :tokens do
11
+ include_examples 'transaction admin should match json schema'
12
+ end
13
+ end
@@ -3,20 +3,17 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type attach' do
6
- before(:example) do
7
- @type = 'base::attach'
8
- @options = { 'replace' => {}, 'add' => {} }
9
- end
6
+ before(:example) { @type = 'base::attach' }
10
7
 
11
- describe '#message_handle', type: :request, level: :base, name: :attach do
8
+ describe '#start_transaction', type: :request,
9
+ level: :base,
10
+ name: :attach do
12
11
  context 'when queue is exclusive' do
13
- it_behaves_like 'message_handle should match json schema'
12
+ include_examples 'transaction should match json schema'
14
13
  end
15
14
 
16
15
  context 'when queue is not exclusive' do
17
- it_behaves_like 'message_handle should match json empty'
16
+ include_examples 'transaction should match json empty'
18
17
  end
19
18
  end
20
-
21
- after(:example) { @gateway.handle_message_simple('base::detach') }
22
19
  end
@@ -5,13 +5,15 @@ require 'spec_helper'
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type create' do
6
6
  before(:example) { @type = 'base::create' }
7
7
 
8
- describe '#message_simple', type: :request, level: :base, name: :create do
8
+ describe '#start_transaction', type: :request,
9
+ level: :base,
10
+ name: :create do
9
11
  context 'when queue is exclusive' do
10
- include_examples 'message_simple should match json schema'
12
+ include_examples 'transaction should match json schema'
11
13
  end
12
14
 
13
15
  context 'when queue is not exclusive' do
14
- include_examples 'message_simple should match json empty'
16
+ include_examples 'transaction should match json empty'
15
17
  end
16
18
  end
17
19
  end
@@ -5,13 +5,15 @@ require 'spec_helper'
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type destroy' do
6
6
  before(:example) { @type = 'base::destroy' }
7
7
 
8
- describe '#message_session', type: :request, level: :base, name: :destroy do
8
+ describe '#start_transaction', type: :request,
9
+ level: :base,
10
+ name: :destroy do
9
11
  context 'when queue is exclusive' do
10
- include_examples 'message_session should match json schema'
12
+ include_examples 'transaction should match json schema'
11
13
  end
12
14
 
13
15
  context 'when queue is not exclusive' do
14
- include_examples 'message_session should match json empty'
16
+ include_examples 'transaction should match json empty'
15
17
  end
16
18
  end
17
19
  end
@@ -3,18 +3,17 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- mesage type detach' do
6
- before(:example) do
7
- @type = 'base::detach'
8
- @options = { 'replace' => {}, 'add' => {} }
9
- end
6
+ before(:example) { @type = 'base::detach' }
10
7
 
11
- describe '#message_handle', type: :request, level: :base, name: :detach do
8
+ describe '#start_transaction_handle', type: :request,
9
+ level: :base,
10
+ name: :detach do
12
11
  context 'when queue is exclusive' do
13
- it_behaves_like 'message_handle should match json schema'
12
+ include_examples 'transaction handle should match json schema'
14
13
  end
15
14
 
16
15
  context 'when queue is not exclusive' do
17
- it_behaves_like 'message_handle should match json empty'
16
+ include_examples 'transaction handle should match json empty'
18
17
  end
19
18
  end
20
19
  end
@@ -5,13 +5,15 @@ require 'spec_helper'
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type info' do
6
6
  before(:example) { @type = 'base::info' }
7
7
 
8
- describe '#message_simple', type: :request, level: :base, name: :info do
8
+ describe '#start_transaction', type: :request,
9
+ level: :base,
10
+ name: :info do
9
11
  context 'when queue is exclusive' do
10
- include_examples 'message_simple should match json schema'
12
+ include_examples 'transaction should match json schema'
11
13
  end
12
14
 
13
15
  context 'when queue is not exclusive' do
14
- include_examples 'message_simple should match json empty'
16
+ include_examples 'transaction should match json empty'
15
17
  end
16
18
  end
17
19
  end
@@ -5,13 +5,15 @@ require 'spec_helper'
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type keepalive' do
6
6
  before(:example) { @type = 'base::keepalive' }
7
7
 
8
- describe '#message_session', type: :request, level: :base, name: :keepalive do
8
+ describe '#start_transaction', type: :request,
9
+ level: :base,
10
+ name: :keepalive do
9
11
  context 'when queue is exclusive' do
10
- include_examples 'message_session should match json schema'
12
+ include_examples 'transaction should match json schema'
11
13
  end
12
14
 
13
15
  context 'when queue is not exclusive' do
14
- include_examples 'message_session should match json empty'
16
+ include_examples 'transaction should match json empty'
15
17
  end
16
18
  end
17
19
  end
@@ -4,108 +4,34 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type offer', broken: true do
6
6
  before(:example) do
7
- sdp = <<END
7
+ @type = 'peer::offer'
8
+ @options = {
9
+ 'sdp' => <<SDP
8
10
  v=0
9
- o=- 7041456084360858977 2 IN IP4 127.0.0.1
10
- s=-
11
+ o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com
12
+ s=
13
+ c=IN IP4 host.atlanta.example.com
11
14
  t=0 0
12
- a=group:BUNDLE audio video
13
- a=msid-semantic: WMS 2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
14
- m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
15
- c=IN IP4 0.0.0.0
16
- a=rtcp:9 IN IP4 0.0.0.0
17
- a=ice-ufrag:T9QI
18
- a=ice-pwd:s9YvfGuavTZN0Lqc53JNInEP
19
- a=fingerprint:sha-256 6D:ED:BC:93:AC:EC:C2:29:03:7D:6A:60:9F:D3:F5:A1:6D:1A:38:CE:F0:C0:EC:C8:5D:87:19:19:BE:0F:89:BB
20
- a=setup:actpass
21
- a=mid:audio
22
- a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
23
- a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
24
- a=sendonly
25
- a=rtcp-mux
26
- a=rtpmap:111 opus/48000/2
27
- a=rtcp-fb:111 transport-cc
28
- a=fmtp:111 minptime=10;useinbandfec=1
29
- a=rtpmap:103 ISAC/16000
30
- a=rtpmap:104 ISAC/32000
31
- a=rtpmap:9 G722/8000
15
+ m=audio 49170 RTP/AVP 0 8 97
32
16
  a=rtpmap:0 PCMU/8000
33
17
  a=rtpmap:8 PCMA/8000
34
- a=rtpmap:106 CN/32000
35
- a=rtpmap:105 CN/16000
36
- a=rtpmap:13 CN/8000
37
- a=rtpmap:126 telephone-event/8000
38
- a=ssrc:2786155512 cname:/+YL75rdcn+UKbf9
39
- a=ssrc:2786155512 msid:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY e0f2490b-468a-4abc-9770-a5f99b13c152
40
- a=ssrc:2786155512 mslabel:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
41
- a=ssrc:2786155512 label:e0f2490b-468a-4abc-9770-a5f99b13c152
42
- m=video 9 UDP/TLS/RTP/SAVPF 100 101 107 116 117 96 97 99 98
43
- c=IN IP4 0.0.0.0
44
- a=rtcp:9 IN IP4 0.0.0.0
45
- a=ice-ufrag:T9QI
46
- a=ice-pwd:s9YvfGuavTZN0Lqc53JNInEP
47
- a=fingerprint:sha-256 6D:ED:BC:93:AC:EC:C2:29:03:7D:6A:60:9F:D3:F5:A1:6D:1A:38:CE:F0:C0:EC:C8:5D:87:19:19:BE:0F:89:BB
48
- a=setup:actpass
49
- a=mid:video
50
- a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
51
- a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
52
- a=extmap:4 urn:3gpp:video-orientation
53
- a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
54
- a=sendonly
55
- a=rtcp-mux
56
- a=rtcp-rsize
57
- a=rtpmap:100 VP8/90000
58
- a=rtcp-fb:100 ccm fir
59
- a=rtcp-fb:100 nack
60
- a=rtcp-fb:100 nack pli
61
- a=rtcp-fb:100 goog-remb
62
- a=rtcp-fb:100 transport-cc
63
- a=rtpmap:101 VP9/90000
64
- a=rtcp-fb:101 ccm fir
65
- a=rtcp-fb:101 nack
66
- a=rtcp-fb:101 nack pli
67
- a=rtcp-fb:101 goog-remb
68
- a=rtcp-fb:101 transport-cc
69
- a=rtpmap:107 H264/90000
70
- a=rtcp-fb:107 ccm fir
71
- a=rtcp-fb:107 nack
72
- a=rtcp-fb:107 nack pli
73
- a=rtcp-fb:107 goog-remb
74
- a=rtcp-fb:107 transport-cc
75
- a=fmtp:107 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
76
- a=rtpmap:116 red/90000
77
- a=rtpmap:117 ulpfec/90000
78
- a=rtpmap:96 rtx/90000
79
- a=fmtp:96 apt=100
80
- a=rtpmap:97 rtx/90000
81
- a=fmtp:97 apt=101
82
- a=rtpmap:99 rtx/90000
83
- a=fmtp:99 apt=107
84
- a=rtpmap:98 rtx/90000
85
- a=fmtp:98 apt=116
86
- a=ssrc-group:FID 1022811670 258141567
87
- a=ssrc:1022811670 cname:/+YL75rdcn+UKbf9
88
- a=ssrc:1022811670 msid:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY 25d58816-114a-41d2-aa08-1039e09f942f
89
- a=ssrc:1022811670 mslabel:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
90
- a=ssrc:1022811670 label:25d58816-114a-41d2-aa08-1039e09f942f
91
- a=ssrc:258141567 cname:/+YL75rdcn+UKbf9
92
- a=ssrc:258141567 msid:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY 25d58816-114a-41d2-aa08-1039e09f942f
93
- a=ssrc:258141567 mslabel:2jKToeOlpzKTn7anwnHOJmzFyhvEYt1kpcMY
94
- a=ssrc:258141567 label:25d58816-114a-41d2-aa08-1039e09f942f
95
- END
96
- @type = 'peer::offer'
97
- @options = { 'replace' => { 'sdp' => sdp.to_s }, 'add' => {} }
18
+ a=rtpmap:97 iLBC/8000
19
+ m=video 51372 RTP/AVP 31 32
20
+ a=rtpmap:31 H261/90000
21
+ a=rtpmap:32 MPV/90000
22
+ SDP
23
+ }
98
24
  end
99
25
 
100
- describe '#message_handle', type: :request, level: :peer, name: :offer do
26
+ describe '#start_transaction_handle', type: :request,
27
+ level: :peer,
28
+ name: :offer do
101
29
  context 'when queue is exclusive' do
102
- it_behaves_like 'message_handle should match json schema'
30
+ it_behaves_like 'transaction handle should match json schema'
103
31
  end
104
32
 
105
33
  context 'when queue is not exclusive' do
106
- it_behaves_like 'message_handle should match json empty'
34
+ it_behaves_like 'transaction handle should match json empty'
107
35
  end
108
36
  end
109
-
110
- after(:example) { @gateway.handle_message_simple('base::detach') }
111
37
  end
@@ -5,38 +5,19 @@ require 'spec_helper'
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type trickle' do
6
6
  before(:example) do
7
7
  @type = 'peer::trickle'
8
- @options = { 'replace' => {}, 'add' => {} }
8
+ candidate = { 'sdpMid' => '..', 'sdpMLineIndex' => 1, 'candidate' => '..' }
9
+ @options = { 'candidate' => candidate }
9
10
  end
10
11
 
11
- describe '#message_handle', type: :request, level: :peer, name: :trickle do
12
- let(:cdd) do
13
- { 'sdpMid' => 'video', 'sdpMLineIndex' => 1, 'candidate' => '...' }
12
+ describe '#start_transaction_handle', type: :request,
13
+ level: :base,
14
+ name: :trickle do
15
+ context 'when queue is exclusive' do
16
+ include_examples 'transaction handle should match json schema'
14
17
  end
15
- let(:candidate) { { 'candidate' => cdd } }
16
- let(:candidates) { { 'candidates' => [cdd, cdd] } }
17
18
 
18
- context 'when queue is exclusive and send 1 candidate' do
19
- it_behaves_like 'message_handle should match json schema' do
20
- let(:options) { { replace: { candidates: candidate } } }
21
- end
22
- end
23
-
24
- context 'when queue is not exclusive and send 1 candidate' do
25
- it_behaves_like 'message_handle should match json empty' do
26
- let(:options) { { replace: { candidates: candidate } } }
27
- end
28
- end
29
-
30
- context 'when queue is exclusive and send 1 candidate' do
31
- it_behaves_like 'message_handle should match json schema' do
32
- let(:options) { { replace: { candidates: candidates } } }
33
- end
34
- end
35
-
36
- context 'when queue is exclusive and send many candidates' do
37
- it_behaves_like 'message_handle should match json empty' do
38
- let(:options) { { replace: { candidates: candidates } } }
39
- end
19
+ context 'when queue is not exclusive' do
20
+ include_examples 'transaction handle should match json empty'
40
21
  end
41
22
  end
42
23
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type trickles' do
6
+ before(:example) do
7
+ @type = 'peer::trickle'
8
+ candidate = { 'sdpMid' => '..', 'sdpMLineIndex' => 1, 'candidate' => '..' }
9
+ @options = { 'candidate' => [candidate, candidate, candidate] }
10
+ end
11
+
12
+ describe '#start_transaction_handle', type: :request,
13
+ level: :base,
14
+ name: :trickles do
15
+ context 'when queue is exclusive' do
16
+ include_examples 'transaction handle should match json schema'
17
+ end
18
+
19
+ context 'when queue is not exclusive' do
20
+ include_examples 'transaction handle should match json empty'
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Janus::Responses::Admin, type: :responses,
6
+ name: :admin do
7
+ let(:message) do
8
+ @gateway.start_transaction_admin do |transaction|
9
+ @response = transaction.publish_message(type)
10
+ end
11
+ end
12
+
13
+ describe '#sessions' do
14
+ let(:type) { 'admin::sessions' }
15
+ let(:response) { @response.sessions }
16
+
17
+ include_examples 'response is', Array
18
+ end
19
+
20
+ describe '#handles' do
21
+ let(:type) { 'admin::handles' }
22
+ let(:response) { @response.handles }
23
+
24
+ include_examples 'response is', Array
25
+ end
26
+
27
+ describe '#info' do
28
+ before(:example) do
29
+ @gateway.start_transaction do |transaction|
30
+ @response = transaction.publish_message('base::attach')
31
+ end
32
+ end
33
+
34
+ let(:type) { 'admin::handle_info' }
35
+ let(:response) { @response.info }
36
+
37
+ include_examples 'admin response with sender is', Hash
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Janus::Responses::Event, type: :responses,
6
+ name: :event,
7
+ broken: true do
8
+ let(:message) do
9
+ # Transaction not exclusive, response is public queue
10
+ @gateway.start_transaction(false) do |transaction|
11
+ @response = transaction.publish_message(type)
12
+ end
13
+ end
14
+
15
+ describe '#event' do
16
+ let(:type) { 'base::info' }
17
+ let(:response) { @response }
18
+ subject(:thread) { @event.join }
19
+
20
+ it 'should eql {}' do
21
+ message
22
+ expect(@response.to_hash).to eql({})
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Janus::Responses::Response, type: :responses,
6
+ name: :response do
7
+ let(:type) { 'base::info' }
8
+ let(:message) do
9
+ @gateway.start_transaction do |transaction|
10
+ @response = transaction.publish_message(type)
11
+ end
12
+ end
13
+
14
+ describe '#to_json' do
15
+ let(:response) { @response.to_json }
16
+
17
+ include_examples 'response is', String
18
+ end
19
+
20
+ describe '#to_hash' do
21
+ let(:response) { @response.to_hash }
22
+
23
+ include_examples 'response is', Hash
24
+ end
25
+
26
+ describe '#to_nice_json' do
27
+ let(:response) { @response.to_nice_json }
28
+
29
+ include_examples 'response is', String
30
+ end
31
+ end