punchblock 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +34 -21
  3. data/Rakefile +20 -0
  4. data/lib/punchblock/client/component_registry.rb +2 -0
  5. data/lib/punchblock/client.rb +2 -2
  6. data/lib/punchblock/command/accept.rb +2 -0
  7. data/lib/punchblock/command/answer.rb +2 -0
  8. data/lib/punchblock/command/dial.rb +2 -0
  9. data/lib/punchblock/command/hangup.rb +2 -0
  10. data/lib/punchblock/command/join.rb +2 -0
  11. data/lib/punchblock/command/mute.rb +2 -0
  12. data/lib/punchblock/command/redirect.rb +2 -0
  13. data/lib/punchblock/command/reject.rb +3 -1
  14. data/lib/punchblock/command/unjoin.rb +2 -0
  15. data/lib/punchblock/command/unmute.rb +2 -0
  16. data/lib/punchblock/command.rb +2 -0
  17. data/lib/punchblock/command_node.rb +2 -0
  18. data/lib/punchblock/component/asterisk/agi/command.rb +4 -2
  19. data/lib/punchblock/component/asterisk/agi.rb +2 -0
  20. data/lib/punchblock/component/asterisk/ami/action.rb +4 -2
  21. data/lib/punchblock/component/asterisk/ami.rb +2 -0
  22. data/lib/punchblock/component/asterisk.rb +2 -0
  23. data/lib/punchblock/component/component_node.rb +2 -0
  24. data/lib/punchblock/component/input.rb +2 -0
  25. data/lib/punchblock/component/output.rb +2 -0
  26. data/lib/punchblock/component/record.rb +2 -0
  27. data/lib/punchblock/component/stop.rb +2 -0
  28. data/lib/punchblock/component.rb +2 -0
  29. data/lib/punchblock/connection/asterisk.rb +4 -1
  30. data/lib/punchblock/connection/connected.rb +2 -0
  31. data/lib/punchblock/connection/generic_connection.rb +5 -0
  32. data/lib/punchblock/connection/xmpp.rb +5 -6
  33. data/lib/punchblock/connection.rb +2 -0
  34. data/lib/punchblock/core_ext/blather/stanza/presence.rb +2 -0
  35. data/lib/punchblock/core_ext/blather/stanza.rb +2 -0
  36. data/lib/punchblock/core_ext/ruby.rb +1 -12
  37. data/lib/punchblock/disconnected_error.rb +2 -0
  38. data/lib/punchblock/event/answered.rb +2 -0
  39. data/lib/punchblock/event/asterisk/ami/event.rb +3 -1
  40. data/lib/punchblock/event/asterisk/ami.rb +2 -0
  41. data/lib/punchblock/event/asterisk.rb +2 -0
  42. data/lib/punchblock/event/complete.rb +3 -1
  43. data/lib/punchblock/event/dtmf.rb +2 -0
  44. data/lib/punchblock/event/end.rb +2 -0
  45. data/lib/punchblock/event/joined.rb +2 -0
  46. data/lib/punchblock/event/offer.rb +6 -0
  47. data/lib/punchblock/event/ringing.rb +2 -0
  48. data/lib/punchblock/event/unjoined.rb +2 -0
  49. data/lib/punchblock/event.rb +2 -0
  50. data/lib/punchblock/has_headers.rb +3 -1
  51. data/lib/punchblock/header.rb +2 -0
  52. data/lib/punchblock/key_value_pair_node.rb +2 -0
  53. data/lib/punchblock/media_container.rb +2 -0
  54. data/lib/punchblock/media_node.rb +2 -0
  55. data/lib/punchblock/protocol_error.rb +2 -0
  56. data/lib/punchblock/rayo_node.rb +4 -3
  57. data/lib/punchblock/ref.rb +2 -0
  58. data/lib/punchblock/translator/asterisk/call.rb +80 -26
  59. data/lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb +3 -1
  60. data/lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb +3 -1
  61. data/lib/punchblock/translator/asterisk/component/asterisk.rb +2 -0
  62. data/lib/punchblock/translator/asterisk/component/input.rb +4 -2
  63. data/lib/punchblock/translator/asterisk/component/output.rb +21 -3
  64. data/lib/punchblock/translator/asterisk/component.rb +2 -0
  65. data/lib/punchblock/translator/asterisk.rb +50 -20
  66. data/lib/punchblock/translator.rb +2 -0
  67. data/lib/punchblock/version.rb +3 -1
  68. data/lib/punchblock.rb +2 -0
  69. data/punchblock.gemspec +2 -2
  70. data/spec/capture_warnings.rb +32 -0
  71. data/spec/punchblock/client/component_registry_spec.rb +2 -0
  72. data/spec/punchblock/client_spec.rb +3 -1
  73. data/spec/punchblock/command/accept_spec.rb +3 -1
  74. data/spec/punchblock/command/answer_spec.rb +3 -1
  75. data/spec/punchblock/command/dial_spec.rb +12 -10
  76. data/spec/punchblock/command/hangup_spec.rb +3 -1
  77. data/spec/punchblock/command/join_spec.rb +11 -9
  78. data/spec/punchblock/command/mute_spec.rb +3 -1
  79. data/spec/punchblock/command/redirect_spec.rb +5 -3
  80. data/spec/punchblock/command/reject_spec.rb +7 -5
  81. data/spec/punchblock/command/unjoin_spec.rb +7 -5
  82. data/spec/punchblock/command/unmute_spec.rb +3 -1
  83. data/spec/punchblock/command_node_spec.rb +9 -7
  84. data/spec/punchblock/component/asterisk/agi/command_spec.rb +21 -19
  85. data/spec/punchblock/component/asterisk/ami/action_spec.rb +19 -17
  86. data/spec/punchblock/component/component_node_spec.rb +5 -3
  87. data/spec/punchblock/component/input_spec.rb +51 -49
  88. data/spec/punchblock/component/output_spec.rb +60 -58
  89. data/spec/punchblock/component/record_spec.rb +36 -34
  90. data/spec/punchblock/connection/asterisk_spec.rb +9 -4
  91. data/spec/punchblock/connection/xmpp_spec.rb +40 -39
  92. data/spec/punchblock/event/answered_spec.rb +4 -2
  93. data/spec/punchblock/event/asterisk/ami/event_spec.rb +9 -7
  94. data/spec/punchblock/event/complete_spec.rb +12 -10
  95. data/spec/punchblock/event/dtmf_spec.rb +6 -4
  96. data/spec/punchblock/event/end_spec.rb +6 -4
  97. data/spec/punchblock/event/joined_spec.rb +8 -6
  98. data/spec/punchblock/event/offer_spec.rb +7 -5
  99. data/spec/punchblock/event/ringing_spec.rb +4 -2
  100. data/spec/punchblock/event/unjoined_spec.rb +8 -6
  101. data/spec/punchblock/header_spec.rb +13 -11
  102. data/spec/punchblock/protocol_error_spec.rb +8 -6
  103. data/spec/punchblock/ref_spec.rb +5 -3
  104. data/spec/punchblock/translator/asterisk/call_spec.rb +261 -14
  105. data/spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb +13 -11
  106. data/spec/punchblock/translator/asterisk/component/asterisk/ami_action_spec.rb +4 -2
  107. data/spec/punchblock/translator/asterisk/component/input_spec.rb +10 -8
  108. data/spec/punchblock/translator/asterisk/component/output_spec.rb +111 -20
  109. data/spec/punchblock/translator/asterisk/component_spec.rb +3 -1
  110. data/spec/punchblock/translator/asterisk_spec.rb +107 -10
  111. data/spec/spec_helper.rb +23 -17
  112. data/spec/support/mock_connection_with_event_handler.rb +2 -0
  113. metadata +43 -41
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -5,7 +7,7 @@ module Punchblock
5
7
  describe Dial do
6
8
 
7
9
  it 'registers itself' do
8
- RayoNode.class_from_registration(:dial, 'urn:xmpp:rayo:1').should == Dial
10
+ RayoNode.class_from_registration(:dial, 'urn:xmpp:rayo:1').should be == Dial
9
11
  end
10
12
 
11
13
  let(:join_params) { {:other_call_id => 'abc123'} }
@@ -15,10 +17,10 @@ module Punchblock
15
17
 
16
18
  it_should_behave_like 'command_headers'
17
19
 
18
- its(:to) { should == 'tel:+14155551212' }
19
- its(:from) { should == 'tel:+13035551212' }
20
- its(:timeout) { should == 30000 }
21
- its(:join) { should == Join.new(join_params) }
20
+ its(:to) { should be == 'tel:+14155551212' }
21
+ its(:from) { should be == 'tel:+13035551212' }
22
+ its(:timeout) { should be == 30000 }
23
+ its(:join) { should be == Join.new(join_params) }
22
24
  end
23
25
 
24
26
  describe "from a stanza" do
@@ -36,10 +38,10 @@ module Punchblock
36
38
 
37
39
  it { should be_instance_of Dial }
38
40
 
39
- its(:to) { should == 'tel:+14155551212' }
40
- its(:from) { should == 'tel:+13035551212' }
41
- its(:timeout) { should == 30000 }
42
- its(:join) { should == Join.new(join_params) }
41
+ its(:to) { should be == 'tel:+14155551212' }
42
+ its(:from) { should be == 'tel:+13035551212' }
43
+ its(:timeout) { should be == 30000 }
44
+ its(:join) { should be == Join.new(join_params) }
43
45
  end
44
46
 
45
47
  describe "#response=" do
@@ -55,7 +57,7 @@ module Punchblock
55
57
 
56
58
  it "should set the call ID from the ref" do
57
59
  subject.response = ref
58
- subject.call_id.should == call_id
60
+ subject.call_id.should be == call_id
59
61
  end
60
62
  end
61
63
  end
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe Hangup do
6
8
  it 'registers itself' do
7
- RayoNode.class_from_registration(:hangup, 'urn:xmpp:rayo:1').should == Hangup
9
+ RayoNode.class_from_registration(:hangup, 'urn:xmpp:rayo:1').should be == Hangup
8
10
  end
9
11
 
10
12
  it_should_behave_like 'command_headers'
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -5,16 +7,16 @@ module Punchblock
5
7
  describe Join do
6
8
 
7
9
  it 'registers itself' do
8
- RayoNode.class_from_registration(:join, 'urn:xmpp:rayo:1').should == Join
10
+ RayoNode.class_from_registration(:join, 'urn:xmpp:rayo:1').should be == Join
9
11
  end
10
12
 
11
13
  describe "when setting options in initializer" do
12
14
  subject { Join.new :other_call_id => 'abc123', :mixer_name => 'blah', :direction => :duplex, :media => :bridge }
13
15
 
14
- its(:other_call_id) { should == 'abc123' }
15
- its(:mixer_name) { should == 'blah' }
16
- its(:direction) { should == :duplex }
17
- its(:media) { should == :bridge }
16
+ its(:other_call_id) { should be == 'abc123' }
17
+ its(:mixer_name) { should be == 'blah' }
18
+ its(:direction) { should be == :duplex }
19
+ its(:media) { should be == :bridge }
18
20
  end
19
21
 
20
22
  describe "from a stanza" do
@@ -32,10 +34,10 @@ module Punchblock
32
34
 
33
35
  it { should be_instance_of Join }
34
36
 
35
- its(:other_call_id) { should == 'abc123' }
36
- its(:mixer_name) { should == 'blah' }
37
- its(:direction) { should == :duplex }
38
- its(:media) { should == :bridge }
37
+ its(:other_call_id) { should be == 'abc123' }
38
+ its(:mixer_name) { should be == 'blah' }
39
+ its(:direction) { should be == :duplex }
40
+ its(:media) { should be == :bridge }
39
41
  end
40
42
  end
41
43
  end
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe Mute do
6
8
  it 'registers itself' do
7
- RayoNode.class_from_registration(:mute, 'urn:xmpp:rayo:1').should == Mute
9
+ RayoNode.class_from_registration(:mute, 'urn:xmpp:rayo:1').should be == Mute
8
10
  end
9
11
 
10
12
  describe "from a stanza" do
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe Redirect do
6
8
  it 'registers itself' do
7
- RayoNode.class_from_registration(:redirect, 'urn:xmpp:rayo:1').should == Redirect
9
+ RayoNode.class_from_registration(:redirect, 'urn:xmpp:rayo:1').should be == Redirect
8
10
  end
9
11
 
10
12
  describe "when setting options in initializer" do
@@ -12,7 +14,7 @@ module Punchblock
12
14
 
13
15
  it_should_behave_like 'command_headers'
14
16
 
15
- its(:to) { should == 'tel:+14045551234' }
17
+ its(:to) { should be == 'tel:+14045551234' }
16
18
  end
17
19
 
18
20
  describe "from a stanza" do
@@ -33,7 +35,7 @@ module Punchblock
33
35
 
34
36
  it_should_behave_like 'command_headers'
35
37
 
36
- its(:to) { should == 'tel:+14045551234' }
38
+ its(:to) { should be == 'tel:+14045551234' }
37
39
  end
38
40
  end # Redirect
39
41
  end # Command
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe Reject do
6
8
  it 'registers itself' do
7
- RayoNode.class_from_registration(:reject, 'urn:xmpp:rayo:1').should == Reject
9
+ RayoNode.class_from_registration(:reject, 'urn:xmpp:rayo:1').should be == Reject
8
10
  end
9
11
 
10
12
  describe "when setting options in initializer" do
@@ -12,7 +14,7 @@ module Punchblock
12
14
 
13
15
  it_should_behave_like 'command_headers'
14
16
 
15
- its(:reason) { should == :busy }
17
+ its(:reason) { should be == :busy }
16
18
  end
17
19
 
18
20
  describe "from a stanza" do
@@ -30,8 +32,8 @@ module Punchblock
30
32
 
31
33
  it { should be_instance_of Reject }
32
34
 
33
- its(:reason) { should == :busy }
34
- its(:headers_hash) { should == { :x_reason_internal => 'bad-skill' } }
35
+ its(:reason) { should be == :busy }
36
+ its(:headers_hash) { should be == { :x_reason_internal => 'bad-skill' } }
35
37
  end
36
38
 
37
39
  describe "with the reason" do
@@ -39,7 +41,7 @@ module Punchblock
39
41
  describe reason do
40
42
  subject { Reject.new :reason => reason }
41
43
 
42
- its(:reason) { should == reason }
44
+ its(:reason) { should be == reason }
43
45
  end
44
46
  end
45
47
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -5,14 +7,14 @@ module Punchblock
5
7
  describe Unjoin do
6
8
 
7
9
  it 'registers itself' do
8
- RayoNode.class_from_registration(:unjoin, 'urn:xmpp:rayo:1').should == Unjoin
10
+ RayoNode.class_from_registration(:unjoin, 'urn:xmpp:rayo:1').should be == Unjoin
9
11
  end
10
12
 
11
13
  describe "when setting options in initializer" do
12
14
  subject { Unjoin.new :other_call_id => 'abc123', :mixer_name => 'blah' }
13
15
 
14
- its(:other_call_id) { should == 'abc123' }
15
- its(:mixer_name) { should == 'blah' }
16
+ its(:other_call_id) { should be == 'abc123' }
17
+ its(:mixer_name) { should be == 'blah' }
16
18
  end
17
19
 
18
20
  describe "from a stanza" do
@@ -28,8 +30,8 @@ module Punchblock
28
30
 
29
31
  it { should be_instance_of Unjoin }
30
32
 
31
- its(:other_call_id) { should == 'abc123' }
32
- its(:mixer_name) { should == 'blah' }
33
+ its(:other_call_id) { should be == 'abc123' }
34
+ its(:mixer_name) { should be == 'blah' }
33
35
  end
34
36
  end
35
37
  end
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe Unmute do
6
8
  it 'registers itself' do
7
- RayoNode.class_from_registration(:unmute, 'urn:xmpp:rayo:1').should == Unmute
9
+ RayoNode.class_from_registration(:unmute, 'urn:xmpp:rayo:1').should be == Unmute
8
10
  end
9
11
 
10
12
  describe "from a stanza" do
@@ -1,9 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
4
6
  module Command
5
7
  describe CommandNode do
6
- its(:state_name) { should == :new }
8
+ its(:state_name) { should be == :new }
7
9
 
8
10
  describe "#new" do
9
11
  describe "with a call/component ID" do
@@ -11,17 +13,17 @@ module Punchblock
11
13
  let(:component_id) { 'abc123' }
12
14
  let(:args) { [{:call_id => call_id, :component_id => component_id}] }
13
15
 
14
- subject { CommandNode.new *args }
16
+ subject { CommandNode.new(*args) }
15
17
 
16
- its(:call_id) { should == call_id }
17
- its(:component_id) { should == component_id }
18
+ its(:call_id) { should be == call_id }
19
+ its(:component_id) { should be == component_id }
18
20
  end
19
21
  end
20
22
 
21
23
  describe "#request!" do
22
24
  before { subject.request! }
23
25
 
24
- its(:state_name) { should == :requested }
26
+ its(:state_name) { should be == :requested }
25
27
 
26
28
  it "should raise a StateMachine::InvalidTransition when received a second time" do
27
29
  lambda { subject.request! }.should raise_error(StateMachine::InvalidTransition)
@@ -45,7 +47,7 @@ module Punchblock
45
47
  subject.execute!
46
48
  end
47
49
 
48
- its(:state_name) { should == :executing }
50
+ its(:state_name) { should be == :executing }
49
51
  end
50
52
  end
51
53
 
@@ -56,7 +58,7 @@ module Punchblock
56
58
  subject.complete!
57
59
  end
58
60
 
59
- its(:state_name) { should == :complete }
61
+ its(:state_name) { should be == :complete }
60
62
 
61
63
  it "should raise a StateMachine::InvalidTransition when received a second time" do
62
64
  lambda { subject.complete! }.should raise_error(StateMachine::InvalidTransition)
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -6,7 +8,7 @@ module Punchblock
6
8
  module AGI
7
9
  describe Command do
8
10
  it 'registers itself' do
9
- RayoNode.class_from_registration(:command, 'urn:xmpp:rayo:asterisk:agi:1').should == Command
11
+ RayoNode.class_from_registration(:command, 'urn:xmpp:rayo:asterisk:agi:1').should be == Command
10
12
  end
11
13
 
12
14
  describe "from a stanza" do
@@ -24,9 +26,9 @@ module Punchblock
24
26
 
25
27
  it_should_behave_like 'event'
26
28
 
27
- its(:name) { should == 'GET VARIABLE' }
28
- its(:params) { should == [Command::Param.new('UNIQUEID')] }
29
- its(:params_array) { should == ['UNIQUEID'] }
29
+ its(:name) { should be == 'GET VARIABLE' }
30
+ its(:params) { should be == [Command::Param.new('UNIQUEID')] }
31
+ its(:params_array) { should be == ['UNIQUEID'] }
30
32
  end
31
33
 
32
34
  describe "when setting options in initializer" do
@@ -35,9 +37,9 @@ module Punchblock
35
37
  :params => ['UNIQUEID']
36
38
  end
37
39
 
38
- its(:name) { should == 'GET VARIABLE' }
39
- its(:params) { should == [Command::Param.new('UNIQUEID')] }
40
- its(:params_array) { should == ['UNIQUEID'] }
40
+ its(:name) { should be == 'GET VARIABLE' }
41
+ its(:params) { should be == [Command::Param.new('UNIQUEID')] }
42
+ its(:params_array) { should be == ['UNIQUEID'] }
41
43
  end
42
44
 
43
45
  class Command
@@ -45,20 +47,20 @@ module Punchblock
45
47
  it 'will auto-inherit nodes' do
46
48
  n = parse_stanza "<param value='bah' />"
47
49
  h = Param.new n.root
48
- h.value.should == 'bah'
50
+ h.value.should be == 'bah'
49
51
  end
50
52
 
51
53
  it 'has a value attribute' do
52
54
  n = Param.new 'en'
53
- n.value.should == 'en'
55
+ n.value.should be == 'en'
54
56
  n.value = 'de'
55
- n.value.should == 'de'
57
+ n.value.should be == 'de'
56
58
  end
57
59
 
58
60
  it 'can determine equality' do
59
61
  a = Param.new 'bah'
60
- a.should == Param.new('bah')
61
- a.should_not == Param.new('boo')
62
+ a.should be == Param.new('bah')
63
+ a.should_not be == Param.new('boo')
62
64
  end
63
65
  end
64
66
 
@@ -79,19 +81,19 @@ module Punchblock
79
81
 
80
82
  it { should be_instance_of Complete::Success }
81
83
 
82
- its(:name) { should == :success }
83
- its(:code) { should == 200 }
84
- its(:result) { should == 0 }
85
- its(:data) { should == '1187188485.0' }
84
+ its(:name) { should be == :success }
85
+ its(:code) { should be == 200 }
86
+ its(:result) { should be == 0 }
87
+ its(:data) { should be == '1187188485.0' }
86
88
 
87
89
  describe "when setting options in initializer" do
88
90
  subject do
89
91
  Complete::Success.new :code => 200, :result => 0, :data => '1187188485.0'
90
92
  end
91
93
 
92
- its(:code) { should == 200 }
93
- its(:result) { should == 0 }
94
- its(:data) { should == '1187188485.0' }
94
+ its(:code) { should be == 200 }
95
+ its(:result) { should be == 0 }
96
+ its(:data) { should be == '1187188485.0' }
95
97
  end
96
98
  end
97
99
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -6,7 +8,7 @@ module Punchblock
6
8
  module AMI
7
9
  describe Action do
8
10
  it 'registers itself' do
9
- RayoNode.class_from_registration(:action, 'urn:xmpp:rayo:asterisk:ami:1').should == Action
11
+ RayoNode.class_from_registration(:action, 'urn:xmpp:rayo:asterisk:ami:1').should be == Action
10
12
  end
11
13
 
12
14
  describe "from a stanza" do
@@ -31,8 +33,8 @@ module Punchblock
31
33
 
32
34
  it_should_behave_like 'event'
33
35
 
34
- its(:name) { should == 'Originate' }
35
- its(:params) { should == [Action::Param.new(:channel, 'SIP/101test'),
36
+ its(:name) { should be == 'Originate' }
37
+ its(:params) { should be == [Action::Param.new(:channel, 'SIP/101test'),
36
38
  Action::Param.new(:context, 'default'),
37
39
  Action::Param.new(:exten, '8135551212'),
38
40
  Action::Param.new(:priority, '1'),
@@ -42,7 +44,7 @@ module Punchblock
42
44
  Action::Param.new(:async, '1')
43
45
  ]}
44
46
 
45
- its(:params_hash) { should == {:channel => 'SIP/101test',
47
+ its(:params_hash) { should be == {:channel => 'SIP/101test',
46
48
  :context => 'default',
47
49
  :exten => '8135551212',
48
50
  :priority => '1',
@@ -55,19 +57,19 @@ module Punchblock
55
57
  describe "testing equality" do
56
58
  context "with the same name and params" do
57
59
  it "should be equal" do
58
- Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' }).should == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
60
+ Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' }).should be == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
59
61
  end
60
62
  end
61
63
 
62
64
  context "with the same name and different params" do
63
65
  it "should be equal" do
64
- Action.new(:name => 'Originate', :params => { :channel => 'SIP/101' }).should_not == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
66
+ Action.new(:name => 'Originate', :params => { :channel => 'SIP/101' }).should_not be == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
65
67
  end
66
68
  end
67
69
 
68
70
  context "with a different name and the same params" do
69
71
  it "should be equal" do
70
- Action.new(:name => 'Hangup', :params => { :channel => 'SIP/101test' }).should_not == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
72
+ Action.new(:name => 'Hangup', :params => { :channel => 'SIP/101test' }).should_not be == Action.new(:name => 'Originate', :params => { :channel => 'SIP/101test' })
71
73
  end
72
74
  end
73
75
  end
@@ -78,9 +80,9 @@ module Punchblock
78
80
  :params => { :channel => 'SIP/101test' }
79
81
  end
80
82
 
81
- its(:name) { should == 'Originate' }
82
- its(:params) { should == [Action::Param.new(:channel, 'SIP/101test')]}
83
- its(:params_hash) { should == { :channel => 'SIP/101test' } }
83
+ its(:name) { should be == 'Originate' }
84
+ its(:params) { should be == [Action::Param.new(:channel, 'SIP/101test')]}
85
+ its(:params_hash) { should be == { :channel => 'SIP/101test' } }
84
86
  end
85
87
 
86
88
  class Action
@@ -108,19 +110,19 @@ module Punchblock
108
110
 
109
111
  it { should be_instance_of Success }
110
112
 
111
- its(:name) { should == :success }
112
- its(:message) { should == "Originate successfully queued" }
113
- its(:attributes) { should == [Attribute.new(:channel, 'SIP/101-3f3f'), Attribute.new(:state, 'Ring')]}
114
- its(:attributes_hash) { should == {:channel => 'SIP/101-3f3f', :state => 'Ring'} }
113
+ its(:name) { should be == :success }
114
+ its(:message) { should be == "Originate successfully queued" }
115
+ its(:attributes) { should be == [Attribute.new(:channel, 'SIP/101-3f3f'), Attribute.new(:state, 'Ring')]}
116
+ its(:attributes_hash) { should be == {:channel => 'SIP/101-3f3f', :state => 'Ring'} }
115
117
 
116
118
  describe "when setting options in initializer" do
117
119
  subject do
118
120
  Success.new :message => 'Originate successfully queued', :attributes => {:channel => 'SIP/101-3f3f', :state => 'Ring'}
119
121
  end
120
122
 
121
- its(:message) { should == 'Originate successfully queued' }
122
- its(:attributes) { should == [Attribute.new(:channel, 'SIP/101-3f3f'), Attribute.new(:state, 'Ring')]}
123
- its(:attributes_hash) { should == {:channel => 'SIP/101-3f3f', :state => 'Ring'} }
123
+ its(:message) { should be == 'Originate successfully queued' }
124
+ its(:attributes) { should be == [Attribute.new(:channel, 'SIP/101-3f3f'), Attribute.new(:state, 'Ring')]}
125
+ its(:attributes_hash) { should be == {:channel => 'SIP/101-3f3f', :state => 'Ring'} }
124
126
  end
125
127
  end
126
128
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Punchblock
@@ -18,7 +20,7 @@ module Punchblock
18
20
  describe "with a complete event" do
19
21
  it "should set the complete event resource" do
20
22
  add_event
21
- subject.complete_event(0.5).should == event
23
+ subject.complete_event(0.5).should be == event
22
24
  end
23
25
 
24
26
  it "should call #complete!" do
@@ -75,7 +77,7 @@ module Punchblock
75
77
 
76
78
  it "should set the component ID from the ref" do
77
79
  subject.response = ref
78
- subject.component_id.should == component_id
80
+ subject.component_id.should be == component_id
79
81
  subject.client.find_component_by_id(component_id).should be subject
80
82
  end
81
83
  end
@@ -94,7 +96,7 @@ module Punchblock
94
96
  it "should be a no-op if the response has already been set" do
95
97
  subject.complete_event = :foo
96
98
  lambda { subject.complete_event = :bar }.should_not raise_error
97
- subject.complete_event(0.5).should == :foo
99
+ subject.complete_event(0.5).should be == :foo
98
100
  end
99
101
  end
100
102
  end # ComponentNode