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
@@ -2,6 +2,6 @@
2
2
 
3
3
  FactoryGirl.define do
4
4
  factory :janus_instance, class: RubyRabbitmqJanus::Models::JanusInstance do
5
- enable true
5
+ enable { true }
6
6
  end
7
7
  end
@@ -5,6 +5,7 @@ require 'spec_helper'
5
5
  # Option token has disabled do response is automatically an error
6
6
  describe 'RubyRabbitmqJanus::RRJAdmin -- allow_token', type: :request,
7
7
  level: :admin,
8
+ broken: true,
8
9
  name: :allow_token do
9
10
  before do
10
11
  help_admin_prepare
@@ -5,6 +5,7 @@ require 'spec_helper'
5
5
  # Option token has disabled do response is automatically an error
6
6
  describe 'RubyRabbitmqJanus::RRJAdmin -- disallow_token', type: :request,
7
7
  level: :admin,
8
+ broken: true,
8
9
  name: :disallow_token do
9
10
  before do
10
11
  help_admin_prepare
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJAdmin -- handle_info', type: :request,
6
6
  level: :admin,
7
+ broken: true,
7
8
  name: :handle_info do
8
9
  before do
9
10
  help_admin_prepare
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJAdmin -- list_handles', type: :request,
6
6
  level: :admin,
7
+ broken: true,
7
8
  name: :list_handles do
8
9
  before do
9
10
  help_admin_prepare
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJAdmin -- list_sessions', type: :request,
6
6
  level: :admin,
7
+ broken: true,
7
8
  name: :list_sessions do
8
9
  before do
9
10
  help_admin_prepare
@@ -5,6 +5,7 @@ require 'spec_helper'
5
5
  # Dont configured in Janus Instance so return automatically an error
6
6
  describe 'RubyRabbitmqJanus::RRJAdmin -- start_pcap', type: :request,
7
7
  level: :admin,
8
+ broken: true,
8
9
  name: :start_pcap do
9
10
  before do
10
11
  help_admin_prepare
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJAdmin -- start_text2pcap', type: :request,
6
6
  level: :admin,
7
+ broken: true,
7
8
  name: :start_text2pcap do
8
9
  before do
9
10
  help_admin_prepare
@@ -5,6 +5,7 @@ require 'spec_helper'
5
5
  # Dont configured in Janus Instance so return automatically an error
6
6
  describe 'RubyRabbitmqJanus::RRJAdmin -- stop_pcap', type: :request,
7
7
  level: :admin,
8
+ broken: true,
8
9
  name: :stop_pcap do
9
10
  before do
10
11
  help_admin_prepare
@@ -4,6 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJAdmin -- stop_text2pcap', type: :request,
6
6
  level: :admin,
7
+ broken: true,
7
8
  name: :stop_text2pcap do
8
9
  before do
9
10
  help_admin_prepare
@@ -6,7 +6,7 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe 'RubyRabbitmqJanus::RRJ -- message type attach' do
9
- before(:example) do
9
+ before do
10
10
  clear
11
11
  @type = 'base::attach'
12
12
  @options = @session_instance
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type create' do
6
- before(:example) do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type create', broken: true do
6
+ before do
7
7
  clear
8
8
  @type = 'base::create'
9
9
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type destroy' do
6
- before(:example) do
6
+ before do
7
7
  clear
8
8
  session
9
9
  @type = 'base::destroy'
@@ -6,7 +6,7 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe 'RubyRabbitmqJanus::RRJ -- mesage type detach' do
9
- before(:example) do
9
+ before do
10
10
  clear
11
11
  attach_base
12
12
  @type = 'base::detach'
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ -- message type info' do
6
- before(:example) do
5
+ describe 'RubyRabbitmqJanus::RRJ -- message type info', broken: true do
6
+ before do
7
7
  clear
8
8
  @type = 'base::info'
9
9
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'RubyRabbitmqJanus::RRJ -- message type keepalive' do
6
- before(:example) do
6
+ before do
7
7
  clear
8
8
  session
9
9
  @type = 'base::keepalive'
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  # @todo Create a message reading by janus
6
6
  describe 'RubyRabbitmqJanus::RRJ -- message type offer' do
7
- before(:example) do
7
+ before do
8
8
  clear
9
9
  attach_base
10
10
 
@@ -6,7 +6,7 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe 'RubyRabbitmqJanus::RRJ -- message type trickle' do
9
- before(:example) do
9
+ before do
10
10
  clear
11
11
  attach_base
12
12
 
@@ -6,7 +6,7 @@
6
6
  require 'spec_helper'
7
7
 
8
8
  describe 'RubyRabbitmqJanus::RRJ -- message type trickles' do
9
- before(:example) do
9
+ before do
10
10
  clear
11
11
  attach_base
12
12
 
@@ -2,50 +2,60 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'RubyRabbitmqJanus::RRJ', type: :config, name: :describe do
6
- context 'Has a version number' do
5
+ describe RubyRabbitmqJanus, type: :config, name: :describe do
6
+ context 'with a version number' do
7
7
  let(:data) { RubyRabbitmqJanus::VERSION }
8
+
8
9
  it_behaves_like 'constant is', String
9
10
  end
10
11
 
11
- context 'Has a name' do
12
+ context 'with a name' do
12
13
  let(:data) { RubyRabbitmqJanus::GEM_NAME }
14
+
13
15
  it_behaves_like 'constant is', String
14
16
  end
15
17
 
16
- context 'Has a author' do
18
+ context 'with a author' do
17
19
  let(:data) { RubyRabbitmqJanus::AUTHORS }
20
+
18
21
  it_behaves_like 'constant is', Array
19
22
  end
20
23
 
21
- context 'Has a email' do
24
+ context 'with a email' do
22
25
  let(:data) { RubyRabbitmqJanus::EMAILS }
26
+
23
27
  it_behaves_like 'constant is', Array
24
28
  end
25
29
 
26
- context 'Has a license' do
30
+ context 'with a license' do
27
31
  let(:data) { RubyRabbitmqJanus::LICENSE }
32
+ let(:licence) { '../../LICENSE' }
33
+
28
34
  it_behaves_like 'constant is', String
29
- it { expect('../../LICENSE').to be_an_existing_file }
35
+ it { expect(licence).to be_an_existing_file }
30
36
  end
31
37
 
32
- context 'Has a description' do
38
+ context 'with a description' do
33
39
  let(:data) { RubyRabbitmqJanus::DESCRIPTION }
40
+
34
41
  it_behaves_like 'constant is', String
35
42
  end
36
43
 
37
- context 'Has a summary description' do
44
+ context 'with a summary description' do
38
45
  let(:data) { RubyRabbitmqJanus::SUMMARY }
46
+
39
47
  it_behaves_like 'constant is', String
40
48
  end
41
49
 
42
- context 'Has a homepage' do
50
+ context 'with a homepage' do
43
51
  let(:data) { RubyRabbitmqJanus::HOMEPAGE }
52
+
44
53
  it_behaves_like 'constant is', String
45
54
  end
46
55
 
47
- context 'Has a post install message' do
56
+ context 'with a post install message' do
48
57
  let(:data) { RubyRabbitmqJanus::POST_INSTALL }
58
+
49
59
  it_behaves_like 'constant is', String
50
60
  end
51
61
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Janus::Concurrencies::Concurrency, type: :thread, name: :concurrency do
6
- let(:concurrency) { RubyRabbitmqJanus::Janus::Concurrencies::Concurrency.new }
6
+ let(:concurrency) { described_class.new }
7
7
 
8
8
  it { expect(concurrency.send(:rabbit)).to be_a(RubyRabbitmqJanus::Rabbit::Connect) }
9
9
  it { expect(concurrency.send(:lock)).to be_a(Mutex) }
@@ -2,9 +2,10 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveThread, type: :thread, name: :keepalive_initializer do
5
+ describe RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveInitializer, type: :thread, name: :keepalive_initializer do
6
6
  let(:instance) { RubyRabbitmqJanus::Models::JanusInstance.find((ENV['MONGO'].match?('true') ? %w[1 2] : [1, 2]).sample) }
7
- let(:concurrency) { RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveInitializer.new(instance) }
7
+ let(:concurrency) { described_class.new(instance) }
8
+
8
9
  it { expect(concurrency.send(:rabbit)).to be_a(RubyRabbitmqJanus::Rabbit::Connect) }
9
10
  it { expect(concurrency.send(:lock)).to be_a(Mutex) }
10
11
  it { expect(concurrency.send(:condition)).to be_a(ConditionVariable) }
@@ -5,10 +5,10 @@ require 'spec_helper'
5
5
  describe RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveThread, type: :thread, name: :keepalive_thread do
6
6
  let(:instance) { RubyRabbitmqJanus::Models::JanusInstance.find((ENV['MONGO'].match?('true') ? %w[1 2] : [1, 2]).sample) }
7
7
  let(:rabbit) { RubyRabbitmqJanus::Janus::Concurrencies::Concurrency.new.send(:rabbit) }
8
- let(:concurrency) { RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveThread.new(instance, rabbit) { nil } }
8
+ let(:concurrency) { described_class.new(instance, rabbit) { nil } }
9
9
 
10
- it { expect(concurrency.instance_variable_get(:@session)).to eql(nil) }
11
- it { expect(concurrency.instance_variable_get(:@publisher)).to eql(nil) }
10
+ it { expect(concurrency.instance_variable_get(:@session)).to be(nil) }
11
+ it { expect(concurrency.instance_variable_get(:@publisher)).to be(nil) }
12
12
  it { expect(concurrency.instance_variable_get(:@rabbit)).to be_a(RubyRabbitmqJanus::Rabbit::Connect) }
13
13
  it { expect(concurrency.instance_variable_get(:@timer)).to be_a(RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveTimer) }
14
14
  it { expect(concurrency.instance_variable_get(:@message)).to be_a(RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveMessage) }
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveTimer, type: :thread, name: :keepalive_timer do
6
- let(:concurrency) { RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveTimer.new }
6
+ let(:concurrency) { described_class.new }
7
7
 
8
8
  it { expect(concurrency.send(:time_to_live)).to be_a(Integer) }
9
9
  it { expect(concurrency.send(:time_to_die)).to be_a(Integer) }
@@ -6,7 +6,7 @@ describe RubyRabbitmqJanus::Janus::Messages::Admin, type: :messages,
6
6
  level: :admin,
7
7
  name: :admin do
8
8
  let(:template) { 'base::info' }
9
- let(:msg_new) { RubyRabbitmqJanus::Janus::Messages::Admin.new(template) }
9
+ let(:msg_new) { described_class.new(template) }
10
10
 
11
11
  describe '#options' do
12
12
  let(:message) { msg_new.options }
@@ -5,8 +5,9 @@ require 'spec_helper'
5
5
  describe RubyRabbitmqJanus::Janus::Messages::Message, type: :messages,
6
6
  name: :message do
7
7
  before { @gateway }
8
+
8
9
  let(:template) { 'base::info' }
9
- let(:msg_new) { RubyRabbitmqJanus::Janus::Messages::Message.new(template) }
10
+ let(:msg_new) { described_class.new(template) }
10
11
 
11
12
  describe '#to_json' do
12
13
  let(:message) { msg_new.to_json }
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  describe RubyRabbitmqJanus::Janus::Messages::Standard, type: :messages,
6
6
  name: :standard do
7
7
  let(:template) { 'base::info' }
8
- let(:msg_new) { RubyRabbitmqJanus::Janus::Messages::Standard.new(template) }
8
+ let(:msg_new) { described_class.new(template) }
9
9
 
10
10
  describe '#options' do
11
11
  let(:message) { msg_new.options }
@@ -27,7 +27,7 @@ describe RubyRabbitmqJanus::Janus::Responses::Admin, type: :responses,
27
27
  end
28
28
 
29
29
  describe '#info' do
30
- before(:example) do
30
+ before do
31
31
  @gateway.start_transaction do |transaction|
32
32
  @response = transaction.publish_message('base::attach')
33
33
  end
@@ -13,11 +13,12 @@ describe RubyRabbitmqJanus::Janus::Responses::Event, type: :responses,
13
13
  end
14
14
 
15
15
  describe '#event' do
16
+ subject(:thread) { @event.join }
17
+
16
18
  let(:type) { 'base::info' }
17
19
  let(:response) { @response }
18
- subject(:thread) { @event.join }
19
20
 
20
- it 'should eql {}' do
21
+ it 'eqls {}' do
21
22
  message
22
23
  expect(@response.to_hash).to eql({})
23
24
  end
@@ -11,19 +11,19 @@ describe RubyRabbitmqJanus::Janus::Responses::Response, type: :responses,
11
11
  end
12
12
  end
13
13
 
14
- describe '#to_json' do
14
+ describe '#to_json', broken: true do
15
15
  let(:response) { @response.to_json }
16
16
 
17
17
  include_examples 'response is', String
18
18
  end
19
19
 
20
- describe '#to_hash' do
20
+ describe '#to_hash', broken: true do
21
21
  let(:response) { @response.to_hash }
22
22
 
23
23
  include_examples 'response is', Hash
24
24
  end
25
25
 
26
- describe '#to_nice_json' do
26
+ describe '#to_nice_json', broken: true do
27
27
  let(:response) { @response.to_nice_json }
28
28
 
29
29
  include_examples 'response is', String
@@ -3,6 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Janus::Responses::Standard, type: :responses,
6
+ broken: true,
6
7
  name: :standard do
7
8
  let(:message) do
8
9
  @gateway.start_transaction do |transaction|
@@ -10,7 +11,7 @@ describe RubyRabbitmqJanus::Janus::Responses::Standard, type: :responses,
10
11
  end
11
12
  end
12
13
 
13
- context 'just session' do
14
+ context 'when just session' do
14
15
  describe '#session' do
15
16
  let(:type) { 'base::create' }
16
17
  let(:response) { @response.session }
@@ -26,8 +27,8 @@ describe RubyRabbitmqJanus::Janus::Responses::Standard, type: :responses,
26
27
  end
27
28
  end
28
29
 
29
- context 'session and sender' do
30
- before(:example) do
30
+ context 'when session and sender' do
31
+ before do
31
32
  @gateway.start_transaction do |transaction|
32
33
  @response = transaction.publish_message('base::create')
33
34
  end
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
6
6
  name: :janus_instance do
7
- let(:model) { RubyRabbitmqJanus::Models::JanusInstance }
7
+ let(:model) { described_class }
8
8
  let(:parameter_mongo) do
9
9
  {
10
10
  'id' => '_id',
@@ -23,7 +23,7 @@ describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
23
23
  }
24
24
  end
25
25
 
26
- context 'Janus Instance model definition' do
26
+ context 'when Janus Instance model definition' do
27
27
  if ENV['MONGO'].match?('true')
28
28
  it { expect(model.attribute_names).to include('_id') }
29
29
  it do
@@ -4,9 +4,10 @@ require 'spec_helper'
4
4
 
5
5
  describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
6
6
  name: :janus_instance do
7
- before { RubyRabbitmqJanus::Models::JanusInstance.delete_all }
7
+ before { described_class.delete_all }
8
+
8
9
  after do
9
- RubyRabbitmqJanus::Models::JanusInstance.delete_all
10
+ described_class.delete_all
10
11
  create_janus_instances
11
12
  end
12
13
 
@@ -19,13 +20,13 @@ describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
19
20
  { id: random_instance }
20
21
  end
21
22
  end
22
- let(:model) { RubyRabbitmqJanus::Models::JanusInstance }
23
+ let(:model) { described_class }
23
24
 
24
- context 'Janus Instance simple transaction' do
25
+ context 'when Janus Instance simple transaction' do
25
26
  it { expect(model.count).to eq(0) }
26
27
  end
27
28
 
28
- context 'many janus instances' do
29
+ context 'when many janus instances' do
29
30
  before do
30
31
  FactoryGirl.create_list(:janus_instance, 5, enable: false)
31
32
  FactoryGirl.create(:janus_instance, janus_id)
@@ -39,17 +40,17 @@ describe RubyRabbitmqJanus::Models::JanusInstance, type: :model,
39
40
  it { expect(model.find_by_instance(one.instance).session).to eq(one.session) }
40
41
  end
41
42
 
42
- context 'Janus Instance enable' do
43
+ context 'when Janus Instance enable' do
43
44
  let(:janus) { FactoryGirl.create(:janus_instance, janus_id) }
44
45
 
45
46
  it { expect(janus.valid?).to be_a(TrueClass) }
46
- it { expect(janus.session).to be_a(Integer) }
47
+ it { expect(janus.session).to be_nil }
47
48
  it { expect(janus.enable).to be_a(TrueClass) }
48
49
  it { expect(janus.enable).to eq(true) }
49
- it { expect(janus.thread).to be_a(Integer) }
50
+ it { expect(janus.thread).to be_nil }
50
51
  end
51
52
 
52
- context 'Janus Instance disable' do
53
+ context 'when Janus Instance disable' do
53
54
  let(:janus) { FactoryGirl.create(:janus_instance, enable: false) }
54
55
 
55
56
  it { expect(janus.valid?).to be_a(TrueClass) }