ruby_rabbitmq_janus 2.5.1 → 2.6.0.pre.226

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/ruby_rabbitmq_janus +67 -0
  4. data/config/default.md +3 -0
  5. data/config/default.yml +6 -0
  6. data/lib/rrj/binary.rb +56 -0
  7. data/lib/rrj/errors/rabbit/base_event.rb +21 -0
  8. data/lib/rrj/errors/rabbit/listener/base.rb +29 -0
  9. data/lib/rrj/errors/rabbit/listener/from.rb +17 -0
  10. data/lib/rrj/errors/rabbit/listener/from_admin.rb +17 -0
  11. data/lib/rrj/errors/rabbit/listener/janus_instance.rb +17 -0
  12. data/lib/rrj/errors/rabbit/publisher/admin.rb +32 -0
  13. data/lib/rrj/errors/rabbit/publisher/base.rb +31 -0
  14. data/lib/rrj/errors/rabbit/publisher/exclusive.rb +33 -0
  15. data/lib/rrj/errors/rabbit/publisher/janus_instance.rb +23 -0
  16. data/lib/rrj/errors/rabbit/publisher/keepalive.rb +17 -0
  17. data/lib/rrj/errors/rabbit/publisher/non_exclusive.rb +33 -0
  18. data/lib/rrj/errors/rabbit/rabbit.rb +12 -6
  19. data/lib/rrj/info.rb +6 -5
  20. data/lib/rrj/init.rb +2 -2
  21. data/lib/rrj/janus/messages/message.rb +1 -1
  22. data/lib/rrj/janus/processus/event.rb +1 -1
  23. data/lib/rrj/janus/processus/keepalive/keepalive_thread.rb +3 -2
  24. data/lib/rrj/janus/responses/janus_instance.rb +28 -0
  25. data/lib/rrj/janus/responses/response.rb +1 -1
  26. data/lib/rrj/janus/transactions/admin.rb +1 -1
  27. data/lib/rrj/janus/transactions/handle.rb +1 -1
  28. data/lib/rrj/janus/transactions/transaction.rb +2 -2
  29. data/lib/rrj/models/concerns/janus_instance_callbacks.rb +9 -5
  30. data/lib/rrj/models/concerns/janus_instance_methods.rb +12 -0
  31. data/lib/rrj/rabbit/base_event.rb +47 -0
  32. data/lib/rrj/rabbit/connect.rb +12 -12
  33. data/lib/rrj/rabbit/{publish/listener.rb → listener/base.rb} +16 -18
  34. data/lib/rrj/rabbit/listener/from.rb +30 -0
  35. data/lib/rrj/rabbit/{publish/listener_admin.rb → listener/from_admin.rb} +6 -4
  36. data/lib/rrj/rabbit/listener/janus_instance.rb +36 -0
  37. data/lib/rrj/rabbit/{publish/publisher_admin.rb → publisher/admin.rb} +5 -10
  38. data/lib/rrj/rabbit/{publish/publisher.rb → publisher/base.rb} +10 -8
  39. data/lib/rrj/rabbit/{publish → publisher}/exclusive.rb +3 -3
  40. data/lib/rrj/rabbit/publisher/janus_instance.rb +27 -0
  41. data/lib/rrj/rabbit/{publish → publisher}/keepalive.rb +4 -2
  42. data/lib/rrj/rabbit/{publish → publisher}/non_exclusive.rb +3 -7
  43. data/lib/rrj/rabbit/rabbit.rb +1 -1
  44. data/lib/rrj/tools/gem/cluster.rb +0 -17
  45. data/lib/rrj/tools/gem/config.rb +9 -0
  46. data/lib/rrj/tools/gem/log.rb +3 -4
  47. data/lib/rrj/tools/gem/option.rb +2 -12
  48. data/lib/rrj/tools/replaces/admin.rb +4 -4
  49. data/lib/rrj/tools/replaces/handle.rb +6 -6
  50. data/lib/rrj/tools/replaces/replace.rb +6 -6
  51. data/lib/rrj/tools/replaces/session.rb +4 -4
  52. data/spec/factories/janus_instance.rb +1 -1
  53. data/spec/request/admin/request_allow_token_spec.rb +1 -0
  54. data/spec/request/admin/request_disallow_token_spec.rb +1 -0
  55. data/spec/request/admin/request_handle_info_spec.rb +1 -0
  56. data/spec/request/admin/request_list_handles_spec.rb +1 -0
  57. data/spec/request/admin/request_list_sessions_spec.rb +1 -0
  58. data/spec/request/admin/request_start_pcap_spec.rb +1 -0
  59. data/spec/request/admin/request_start_text2pcap_spec.rb +1 -0
  60. data/spec/request/admin/request_stop_pcap_spec.rb +1 -0
  61. data/spec/request/admin/request_stop_text2pcap_spec.rb +1 -0
  62. data/spec/request/base/request_attach_spec.rb +1 -1
  63. data/spec/request/base/request_create_spec.rb +2 -2
  64. data/spec/request/base/request_destroy_spec.rb +1 -1
  65. data/spec/request/base/request_detach_spec.rb +1 -1
  66. data/spec/request/base/request_info_spec.rb +2 -2
  67. data/spec/request/base/request_keepalive_spec.rb +1 -1
  68. data/spec/request/peer/request_offer_spec.rb +1 -1
  69. data/spec/request/peer/request_trickle_spec.rb +1 -1
  70. data/spec/request/peer/request_trickles_spec.rb +1 -1
  71. data/spec/rrj/{rrj_spec.rb → ruby_rabbitmq_janus_spec.rb} +21 -11
  72. data/spec/{thread/concurencies_spec.rb → ruby_rabbitmq_janus/janus/concurrencies/concurrency_spec.rb} +1 -1
  73. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_initializer_spec.rb +3 -2
  74. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_thread_spec.rb +3 -3
  75. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_timer_spec.rb +1 -1
  76. data/spec/{rrj/messages/messages_admin_spec.rb → ruby_rabbitmq_janus/janus/messages/admin_spec.rb} +1 -1
  77. data/spec/{rrj/messages/messages_message_spec.rb → ruby_rabbitmq_janus/janus/messages/message_spec.rb} +2 -1
  78. data/spec/{rrj/messages/messages_standard_spec.rb → ruby_rabbitmq_janus/janus/messages/standard_spec.rb} +1 -1
  79. data/spec/{rrj/responses/responses_admin_spec.rb → ruby_rabbitmq_janus/janus/responses/admin_spec.rb} +1 -1
  80. data/spec/{rrj/responses/responses_event_spec.rb → ruby_rabbitmq_janus/janus/responses/event_spec.rb} +3 -2
  81. data/spec/{rrj/responses/responses_response_spec.rb → ruby_rabbitmq_janus/janus/responses/response_spec.rb} +3 -3
  82. data/spec/{rrj/responses/responses_standard_spec.rb → ruby_rabbitmq_janus/janus/responses/standard_spec.rb} +4 -3
  83. data/spec/{rrj → ruby_rabbitmq_janus}/models/janus_instance_definition_spec.rb +2 -2
  84. data/spec/{rrj/models/janus_instance_transaction_spec.rb → ruby_rabbitmq_janus/models/janus_instance_spec.rb} +10 -9
  85. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/connect_spec.rb +1 -1
  86. data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +15 -0
  87. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_2_spec.rb +3 -3
  88. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_spec.rb +3 -3
  89. data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +12 -0
  90. data/spec/{rrj/rabbit/publish/base_publisher_spec.rb → ruby_rabbitmq_janus/rabbit/publisher/base_spec.rb} +3 -3
  91. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/exclusive_spec.rb +0 -0
  92. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/non_exclusive_spec.rb +0 -0
  93. data/spec/{rrj/tools/gem/rrj_cluster_spec.rb → ruby_rabbitmq_janus/tools/cluster_spec.rb} +1 -21
  94. data/spec/{rrj/tools/gem/rrj_config_spec.rb → ruby_rabbitmq_janus/tools/config_spec.rb} +26 -14
  95. data/spec/{rrj/tools/gem/rrj_log_spec.rb → ruby_rabbitmq_janus/tools/log_spec.rb} +10 -10
  96. data/spec/{rrj/tools/replace/replace_admin_spec.rb → ruby_rabbitmq_janus/tools/replaces/admin_spec.rb} +15 -15
  97. data/spec/{rrj/tools/replace/replace_handle_spec.rb → ruby_rabbitmq_janus/tools/replaces/handle_spec.rb} +14 -14
  98. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools/replaces}/replace_spec.rb +16 -17
  99. data/spec/{rrj/tools/replace/replace_session_spec.rb → ruby_rabbitmq_janus/tools/replaces/session_spec.rb} +14 -14
  100. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools}/type_spec.rb +19 -19
  101. data/spec/spec_helper.rb +1 -1
  102. data/spec/support/examples_request.rb +1 -1
  103. data/spec/support/type.rb +3 -3
  104. metadata +83 -59
  105. data/lib/rrj/errors/rabbit/publish/admin.rb +0 -30
  106. data/lib/rrj/errors/rabbit/publish/base_publisher.rb +0 -23
  107. data/lib/rrj/errors/rabbit/publish/exclusive.rb +0 -31
  108. data/lib/rrj/errors/rabbit/publish/listener.rb +0 -30
  109. data/lib/rrj/errors/rabbit/publish/non_exclusive.rb +0 -31
  110. data/lib/rrj/errors/rabbit/publish/publisher.rb +0 -38
  111. data/lib/rrj/rabbit/publish/base_publisher.rb +0 -50
  112. data/spec/rrj/rabbit/publish/admin_spec.rb +0 -12
  113. data/spec/rrj/rabbit/publish/listener_spec.rb +0 -15
  114. data/spec/rrj/rabbit/publish/publisher_spec.rb +0 -13
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Connect, type: :rabbit,
6
6
  name: :connect do
7
- let(:connect) { RubyRabbitmqJanus::Rabbit::Connect.new }
7
+ let(:connect) { described_class.new }
8
8
 
9
9
  describe '#start' do
10
10
  it { expect(connect.start.class).to eq(Bunny::Session) }
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Rabbit::Listener::From, type: :rabbit,
6
+ name: :listener do
7
+ let(:publish) do
8
+ rabbit = RubyRabbitmqJanus::Rabbit::Connect.new.rabbit
9
+ described_class.new(rabbit)
10
+ end
11
+
12
+ # @todo Complete spec publisher listener
13
+ describe 'Listener from' do
14
+ end
15
+ end
@@ -4,21 +4,21 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Propertie, type: :rabbit,
6
6
  name: :propertie do
7
- let(:rabbit) { RubyRabbitmqJanus::Rabbit::Propertie.new }
7
+ let(:rabbit) { described_class.new }
8
8
 
9
9
  describe '#options' do
10
10
  it { expect(rabbit.options).to match_json_schema(:rabbit_options) }
11
11
  end
12
12
 
13
13
  describe '#options_admin', broken: true do
14
- context 'For admin request' do
14
+ context 'when admin request' do
15
15
  it do
16
16
  expect(rabbit.options_admin('admin::sessions')).to \
17
17
  match_json_schema(:rabbit_options_admin)
18
18
  end
19
19
  end
20
20
 
21
- context 'For base request' do
21
+ context 'when base request' do
22
22
  it do
23
23
  expect(rabbit.options_admin('request::create')).to \
24
24
  match_json_schema(:rabbit_options)
@@ -5,21 +5,21 @@ require 'spec_helper'
5
5
  describe RubyRabbitmqJanus::Rabbit::Propertie, type: :rabbit,
6
6
  name: :propertie,
7
7
  instances: true do
8
- let(:rabbit) { RubyRabbitmqJanus::Rabbit::Propertie.new(2) }
8
+ let(:rabbit) { described_class.new(2) }
9
9
 
10
10
  describe '#options' do
11
11
  it { expect(rabbit.options).to match_json_schema(:rabbit_options2) }
12
12
  end
13
13
 
14
14
  describe '#options_admin', broken: true do
15
- context 'For admin request' do
15
+ context 'when admin request' do
16
16
  it do
17
17
  expect(rabbit.options_admin('admin::sessions')).to \
18
18
  match_json_schema(:rabbit_options_admin2)
19
19
  end
20
20
  end
21
21
 
22
- context 'For base request' do
22
+ context 'when base request' do
23
23
  it do
24
24
  expect(rabbit.options_admin('request::create')).to \
25
25
  match_json_schema(:rabbit_options2)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Rabbit::Publisher::Admin, type: :rabbit,
6
+ name: :publisher_admin do
7
+ let(:pusblish) { described_class.new }
8
+
9
+ # @todo Complete test publisherAdmin
10
+ describe 'Admin' do
11
+ end
12
+ end
@@ -3,10 +3,10 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Rabbit::Publisher, type: :rabbit,
6
- name: :base_publisher do
7
- let(:publish) { RubyRabbitmqJanus::Rabbit::Publisher::BasePublisher.new }
6
+ name: :base_event do
7
+ let(:publish) { RubyRabbitmqJanus::Rabbit::BaseEvent.new }
8
8
 
9
- describe 'BasePublisher' do
9
+ describe 'BaseEvent' do
10
10
  describe '#new' do
11
11
  it { expect(publish).to have_attributes(responses: []) }
12
12
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Tools::Cluster, type: :tools, name: :cluster do
6
- let(:cluster) { RubyRabbitmqJanus::Tools::Cluster.instance }
6
+ let(:cluster) { described_class.instance }
7
7
  let(:model) { RubyRabbitmqJanus::Models::JanusInstance }
8
8
  let(:number_of_instance) { Random.new.rand(100) }
9
9
  let(:name_queue) { "to-janus-#{number_of_instance}" }
@@ -16,24 +16,4 @@ describe RubyRabbitmqJanus::Tools::Cluster, type: :tools, name: :cluster do
16
16
  it do
17
17
  expect(cluster.queue_admin_to(number_of_instance)).to eql(name_queue_admin)
18
18
  end
19
-
20
- it do
21
- expect { cluster.create_session }.not_to raise_error
22
- end
23
-
24
- it do
25
- expect { cluster.restart_session }.not_to raise_error
26
- end
27
-
28
- context 'When active record is loaded', orm: :active_record do
29
- it do
30
- expect(cluster.create_session).to be_a(model)
31
- end
32
- end
33
-
34
- context 'When mongoid is loaded', orm: :mongoid do
35
- it do
36
- expect(cluster.create_session).to be_a(model)
37
- end
38
- end
39
19
  end
@@ -3,71 +3,83 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Tools::Config, type: :tools, name: :config do
6
- before(:context) { @cfg = RubyRabbitmqJanus::Tools::Config.instance }
6
+ before(:context) { @cfg = described_class.instance }
7
7
 
8
8
  it 'When file is correct' do
9
9
  expect(@cfg.options).to match_json_schema(:config)
10
10
  end
11
11
 
12
- context 'janus/session/keepalive' do
13
- context 'method time_to_live' do
12
+ context 'when janus/session/keepalive' do
13
+ context 'with method time_to_live' do
14
14
  let(:method) { @cfg.time_to_live }
15
+
15
16
  it_behaves_like 'type and default value', Integer, 55
16
17
  end
17
18
 
18
- context 'method alias ttl' do
19
+ context 'with method alias ttl' do
19
20
  let(:method) { @cfg.ttl }
21
+
20
22
  it_behaves_like 'type and default value', Integer, 55
21
23
  end
22
24
  end
23
25
 
24
- context 'janus/plugins/0' do
26
+ context 'when janus/plugins/0' do
25
27
  let(:method) { @cfg.plugin_at }
28
+
26
29
  it_behaves_like 'type and default value', String, 'janus.plugin.echotest'
27
30
  end
28
31
 
29
- context 'janus/plugins/1' do
32
+ context 'when janus/plugins/1' do
30
33
  let(:method) { @cfg.plugin_at(1) }
34
+
31
35
  it_behaves_like 'type and default value', String, 'janus.plugin.videoroom'
32
36
  end
33
37
 
34
- context 'janus/plugins/2' do
38
+ context 'when janus/plugins/2' do
35
39
  let(:method) { @cfg.plugin_at(2) }
40
+
36
41
  it_behaves_like 'type and default value', String, 'janus.plugin.sip'
37
42
  end
38
43
 
39
- context 'janus/plugins/3' do
44
+ context 'when janus/plugins/3' do
40
45
  let(:method) { @cfg.plugin_at(3) }
46
+
41
47
  it_behaves_like 'type and default value', String, ''
42
48
  end
43
49
 
44
- context 'gem/cluster/enabled' do
50
+ context 'when gem/cluster/enabled' do
45
51
  let(:method) { @cfg.cluster }
52
+
46
53
  it_behaves_like 'type and default value', FalseClass, false
47
54
  end
48
55
 
49
- context 'queues/standard/from' do
56
+ context 'when queues/standard/from' do
50
57
  let(:method) { @cfg.queue_from }
58
+
51
59
  it_behaves_like 'type and default value', String, 'from-janus'
52
60
  end
53
61
 
54
- context 'queues/standard/to' do
62
+ context 'when queues/standard/to' do
55
63
  let(:method) { @cfg.queue_to }
64
+
56
65
  it_behaves_like 'type and default value', String, 'to-janus'
57
66
  end
58
67
 
59
- context 'queues/admin/from' do
68
+ context 'when queues/admin/from' do
60
69
  let(:method) { @cfg.queue_admin_from }
70
+
61
71
  it_behaves_like 'type and default value', String, 'from-janus-admin'
62
72
  end
63
73
 
64
- context 'queues/admin/to' do
74
+ context 'when queues/admin/to' do
65
75
  let(:method) { @cfg.queue_admin_to }
76
+
66
77
  it_behaves_like 'type and default value', String, 'to-janus-admin'
67
78
  end
68
79
 
69
- context 'gem/log/level' do
80
+ context 'when gem/log/level' do
70
81
  let(:method) { @cfg.log_level }
82
+
71
83
  it_behaves_like 'type and default value', Symbol, :DEBUG
72
84
  end
73
85
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::Log', type: :tools, name: :log do
5
+ describe RubyRabbitmqJanus::Tools::Log, type: :tools, name: :log do
6
6
  let(:levels) do
7
7
  {
8
8
  DEBUG: Logger::DEBUG,
@@ -14,8 +14,8 @@ describe 'RubyRabbitmqJanus::Log', type: :tools, name: :log do
14
14
  }
15
15
  end
16
16
  let(:sensitives) { %i[admin_secret apisecret] }
17
- let(:log) { RubyRabbitmqJanus::Tools::Log.instance }
18
- let(:log_constant) { RubyRabbitmqJanus::Tools::Log }
17
+ let(:log) { described_class.instance }
18
+ let(:log_constant) { described_class }
19
19
  let(:new_level) { Random.new.rand(5) }
20
20
  let(:message) { '## test ##' }
21
21
  let(:last_line) { IO.readlines('log/ruby-rabbitmq-janus.log')[-1..-1][0] }
@@ -42,40 +42,40 @@ describe 'RubyRabbitmqJanus::Log', type: :tools, name: :log do
42
42
  context 'when write a message unknown' do
43
43
  before { log.unknown(message) }
44
44
 
45
- it { expect(last_line).to include('A, [RubyRabbitmqJanus] ## test ##') }
45
+ it { expect(last_line).to include('A, ## test ##') }
46
46
  end
47
47
 
48
48
  context 'when write a message fatal' do
49
49
  before { log.fatal(message) }
50
50
 
51
- it { expect(last_line).to include('F, [RubyRabbitmqJanus] ## test ##') }
51
+ it { expect(last_line).to include('F, ## test ##') }
52
52
  end
53
53
 
54
54
  context 'when write a message error' do
55
55
  before { log.error(message) }
56
56
 
57
- it { expect(last_line).to include('E, [RubyRabbitmqJanus] ## test ##') }
57
+ it { expect(last_line).to include('E, ## test ##') }
58
58
  end
59
59
 
60
60
  context 'when write a message warn' do
61
61
  before { log.warn(message) }
62
62
 
63
- it { expect(last_line).to include('W, [RubyRabbitmqJanus] ## test ##') }
63
+ it { expect(last_line).to include('W, ## test ##') }
64
64
  end
65
65
 
66
66
  context 'when write a message info' do
67
67
  before { log.info(message) }
68
68
 
69
- it { expect(last_line).to include('I, [RubyRabbitmqJanus] ## test ##') }
69
+ it { expect(last_line).to include('I, ## test ##') }
70
70
  end
71
71
 
72
72
  context 'when write a message debug' do
73
73
  before { log.debug(message) }
74
74
 
75
- it { expect(last_line).to include('D, [RubyRabbitmqJanus] ## test ##') }
75
+ it { expect(last_line).to include('D, ## test ##') }
76
76
  end
77
77
 
78
- context 'Whane level is changed' do
78
+ context 'when level is changed' do
79
79
  it 'Change level' do
80
80
  expect(log.save_level(new_level)).to eql(log.level)
81
81
  end
@@ -2,16 +2,15 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::Log', type: :tools, name: :replace_admin do
5
+ describe RubyRabbitmqJanus::Tools::Replaces::Admin, type: :tools, name: :replace_admin do
6
6
  subject(:replace) do
7
7
  # Get request JSON file
8
8
  rqe = RubyRabbitmqJanus::Tools::Requests.instance.requests['test::replace']
9
9
  # Open request file
10
- RubyRabbitmqJanus::Tools::Replaces::Admin.new(JSON.parse(File.read(rqe)),
11
- options)
10
+ described_class.new(JSON.parse(File.read(rqe)), options)
12
11
  end
13
12
 
14
- context 'replace classic element' do
13
+ context 'when replace classic element' do
15
14
  let(:opt_session) { Random.rand(123_456_789..987_654_321) }
16
15
  let(:opt_handle) { Random.rand(123_456_789..987_654_321) }
17
16
  let(:opt_plugin) { 'janus.plugin.echotest' }
@@ -36,50 +35,51 @@ describe 'RubyRabbitmqJanus::Log', type: :tools, name: :replace_admin do
36
35
  }
37
36
  end
38
37
 
39
- context 'transform request' do
38
+ context 'with ransform request' do
40
39
  it do
41
40
  expect(replace.transform_request).to be_kind_of(Hash)
42
41
  end
43
42
  end
44
43
 
45
- context 'transform request session_id' do
44
+ context 'with ransform request session_id' do
46
45
  include_examples 'test replace in request', 'session_id', Integer
47
46
  end
48
47
 
49
- context 'transform request transaction' do
48
+ context 'with ransform request transaction' do
50
49
  include_examples 'test replace in request nil', 'transaction'
51
50
  end
52
51
 
53
- context 'transform request handle_id' do
52
+ context 'with ransform request handle_id' do
54
53
  include_examples 'test replace in request', 'handle_id', Integer
55
54
  end
56
55
 
57
- context 'transform request plugin' do
56
+ context 'with ransform request plugin' do
58
57
  include_examples 'test replace in request', 'plugin', String
59
58
  end
60
59
 
61
- context 'transform request candidates' do
60
+ context 'with ransform request candidates' do
62
61
  include_examples 'test replace in request', 'candidates', Array
63
62
  end
64
63
 
65
- context 'transform request audio' do
64
+ context 'with ransform request audio' do
66
65
  include_examples 'test replace in request nil', 'audio'
67
66
  end
68
67
 
69
- context 'transform request sdp' do
68
+ context 'with ransform request sdp' do
70
69
  let(:key) { 'jsep' }
70
+
71
71
  include_examples 'test replace in request', 'sdp', String
72
72
  end
73
73
 
74
- context 'transform request debug' do
74
+ context 'with ransform request debug' do
75
75
  include_examples 'test replace in request', 'debug', TrueClass
76
76
  end
77
77
 
78
- context 'transform request level' do
78
+ context 'with ransform request level' do
79
79
  include_examples 'test replace in request', 'level', Integer
80
80
  end
81
81
 
82
- context 'transform request transaction' do
82
+ context 'with ransform request transaction' do
83
83
  include_examples 'test replace in request nil', 'admin_secret'
84
84
  end
85
85
  end
@@ -2,16 +2,15 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::Log', type: :tools, name: :replace_handle do
5
+ describe RubyRabbitmqJanus::Tools::Replaces::Handle, type: :tools, name: :replace_handle do
6
6
  subject(:replace) do
7
7
  # Get request JSON file
8
8
  rqe = RubyRabbitmqJanus::Tools::Requests.instance.requests['test::replace']
9
9
  # Open request file
10
- RubyRabbitmqJanus::Tools::Replaces::Handle.new(JSON.parse(File.read(rqe)),
11
- options)
10
+ described_class.new(JSON.parse(File.read(rqe)), options)
12
11
  end
13
12
 
14
- context 'replace classic element' do
13
+ context 'when replace classic element' do
15
14
  let(:opt_session) { Random.rand(123_456_789..987_654_321) }
16
15
  let(:opt_handle) { Random.rand(123_456_789..987_654_321) }
17
16
  let(:opt_plugin) { 'janus.plugin.echotest' }
@@ -32,46 +31,47 @@ describe 'RubyRabbitmqJanus::Log', type: :tools, name: :replace_handle do
32
31
  }
33
32
  end
34
33
 
35
- context 'transform request' do
34
+ context 'with ransform request' do
36
35
  it do
37
36
  expect(replace.transform_request).to be_kind_of(Hash)
38
37
  end
39
38
  end
40
39
 
41
- context 'transform request session_id' do
40
+ context 'with ransform request session_id' do
42
41
  include_examples 'test replace in request', 'session_id', Integer
43
42
  end
44
43
 
45
- context 'transform request transaction' do
44
+ context 'with ransform request transaction' do
46
45
  include_examples 'test replace in request nil', 'transaction'
47
46
  end
48
47
 
49
- context 'transform request handle_id' do
48
+ context 'with ransform request handle_id' do
50
49
  include_examples 'test replace in request', 'handle_id', Integer
51
50
  end
52
51
 
53
- context 'transform request plugin' do
52
+ context 'with ransform request plugin' do
54
53
  include_examples 'test replace in request', 'plugin', String
55
54
  end
56
55
 
57
- context 'transform request candidates' do
56
+ context 'with ransform request candidates' do
58
57
  include_examples 'test replace in request', 'candidates', Array
59
58
  end
60
59
 
61
- context 'transform request audio' do
60
+ context 'with ransform request audio' do
62
61
  include_examples 'test replace in request nil', 'audio'
63
62
  end
64
63
 
65
- context 'transform request sdp' do
64
+ context 'with ransform request sdp' do
66
65
  let(:key) { 'jsep' }
66
+
67
67
  include_examples 'test replace in request', 'sdp', String
68
68
  end
69
69
 
70
- context 'transform request debug' do
70
+ context 'with ransform request debug' do
71
71
  include_examples 'test replace in request nil', 'debug'
72
72
  end
73
73
 
74
- context 'transform request level' do
74
+ context 'with ransform request level' do
75
75
  include_examples 'test replace in request nil', 'level'
76
76
  end
77
77
  end