punchblock 2.5.2 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +2 -0
  3. data/CHANGELOG.md +6 -0
  4. data/README.markdown +2 -1
  5. data/lib/punchblock/translator/asterisk/call.rb +3 -3
  6. data/lib/punchblock/translator/asterisk/component/mrcp_recog_prompt.rb +15 -9
  7. data/lib/punchblock/translator/asterisk/component/output.rb +8 -1
  8. data/lib/punchblock/translator/input_component.rb +2 -0
  9. data/lib/punchblock/version.rb +1 -1
  10. data/punchblock.gemspec +1 -1
  11. data/spec/punchblock/client/component_registry_spec.rb +3 -3
  12. data/spec/punchblock/client_spec.rb +22 -15
  13. data/spec/punchblock/command/accept_spec.rb +17 -7
  14. data/spec/punchblock/command/answer_spec.rb +19 -9
  15. data/spec/punchblock/command/dial_spec.rb +76 -27
  16. data/spec/punchblock/command/hangup_spec.rb +17 -7
  17. data/spec/punchblock/command/join_spec.rb +78 -24
  18. data/spec/punchblock/command/mute_spec.rb +3 -3
  19. data/spec/punchblock/command/redirect_spec.rb +33 -12
  20. data/spec/punchblock/command/reject_spec.rb +41 -14
  21. data/spec/punchblock/command/unjoin_spec.rb +29 -12
  22. data/spec/punchblock/command/unmute_spec.rb +3 -3
  23. data/spec/punchblock/command_node_spec.rb +43 -20
  24. data/spec/punchblock/component/asterisk/agi/command_spec.rb +52 -12
  25. data/spec/punchblock/component/asterisk/ami/action_spec.rb +69 -21
  26. data/spec/punchblock/component/component_node_spec.rb +12 -12
  27. data/spec/punchblock/component/input_spec.rb +304 -87
  28. data/spec/punchblock/component/output_spec.rb +434 -173
  29. data/spec/punchblock/component/prompt_spec.rb +63 -20
  30. data/spec/punchblock/component/receive_fax_spec.rb +43 -14
  31. data/spec/punchblock/component/record_spec.rb +215 -71
  32. data/spec/punchblock/component/send_fax_spec.rb +54 -15
  33. data/spec/punchblock/connection/asterisk_spec.rb +34 -24
  34. data/spec/punchblock/connection/freeswitch_spec.rb +9 -9
  35. data/spec/punchblock/connection/xmpp_spec.rb +92 -83
  36. data/spec/punchblock/event/answered_spec.rb +14 -4
  37. data/spec/punchblock/event/asterisk/ami/event_spec.rb +34 -12
  38. data/spec/punchblock/event/complete_spec.rb +36 -16
  39. data/spec/punchblock/event/dtmf_spec.rb +9 -3
  40. data/spec/punchblock/event/end_spec.rb +43 -10
  41. data/spec/punchblock/event/input_timers_started_spec.rb +1 -1
  42. data/spec/punchblock/event/joined_spec.rb +29 -7
  43. data/spec/punchblock/event/offer_spec.rb +41 -10
  44. data/spec/punchblock/event/ringing_spec.rb +14 -4
  45. data/spec/punchblock/event/started_speaking_spec.rb +9 -3
  46. data/spec/punchblock/event/stopped_speaking_spec.rb +9 -3
  47. data/spec/punchblock/event/unjoined_spec.rb +24 -6
  48. data/spec/punchblock/protocol_error_spec.rb +16 -13
  49. data/spec/punchblock/ref_spec.rb +90 -26
  50. data/spec/punchblock/translator/asterisk/call_spec.rb +176 -161
  51. data/spec/punchblock/translator/asterisk/component/asterisk/agi_command_spec.rb +18 -18
  52. data/spec/punchblock/translator/asterisk/component/asterisk/ami_action_spec.rb +9 -9
  53. data/spec/punchblock/translator/asterisk/component/composed_prompt_spec.rb +14 -14
  54. data/spec/punchblock/translator/asterisk/component/input_spec.rb +57 -36
  55. data/spec/punchblock/translator/asterisk/component/mrcp_native_prompt_spec.rb +50 -50
  56. data/spec/punchblock/translator/asterisk/component/mrcp_prompt_spec.rb +59 -48
  57. data/spec/punchblock/translator/asterisk/component/output_spec.rb +231 -221
  58. data/spec/punchblock/translator/asterisk/component/record_spec.rb +82 -82
  59. data/spec/punchblock/translator/asterisk/component/stop_by_redirect_spec.rb +10 -10
  60. data/spec/punchblock/translator/asterisk/component_spec.rb +4 -4
  61. data/spec/punchblock/translator/asterisk_spec.rb +89 -82
  62. data/spec/punchblock/translator/freeswitch/call_spec.rb +114 -99
  63. data/spec/punchblock/translator/freeswitch/component/flite_output_spec.rb +19 -19
  64. data/spec/punchblock/translator/freeswitch/component/input_spec.rb +24 -24
  65. data/spec/punchblock/translator/freeswitch/component/output_spec.rb +23 -23
  66. data/spec/punchblock/translator/freeswitch/component/record_spec.rb +78 -78
  67. data/spec/punchblock/translator/freeswitch/component/tts_output_spec.rb +19 -19
  68. data/spec/punchblock/translator/freeswitch/component_spec.rb +8 -8
  69. data/spec/punchblock/translator/freeswitch_spec.rb +66 -59
  70. data/spec/punchblock/uri_list_spec.rb +45 -10
  71. data/spec/punchblock_spec.rb +13 -13
  72. data/spec/spec_helper.rb +18 -11
  73. data/spec/support/mock_connection_with_event_handler.rb +1 -1
  74. metadata +5 -4
@@ -31,40 +31,40 @@ module Punchblock
31
31
  before { original_command.request! }
32
32
 
33
33
  it "returns an error if the call is not answered yet" do
34
- mock_call.should_receive(:answered?).and_return(false)
34
+ expect(mock_call).to receive(:answered?).and_return(false)
35
35
  subject.execute
36
36
  error = ProtocolError.new.setup 'option error', 'Record cannot be used on a call that is not answered.'
37
- original_command.response(0.1).should be == error
37
+ expect(original_command.response(0.1)).to eq(error)
38
38
  end
39
39
 
40
- before { mock_call.stub(:answered?).and_return(true) }
40
+ before { allow(mock_call).to receive(:answered?).and_return(true) }
41
41
 
42
42
  it "sets command response to a reference to the component" do
43
- ami_client.should_receive(:send_action)
43
+ expect(ami_client).to receive(:send_action)
44
44
  subject.execute
45
- original_command.response(0.1).should be_a Ref
46
- original_command.component_id.should be == subject.id
45
+ expect(original_command.response(0.1)).to be_a Ref
46
+ expect(original_command.component_id).to eq(subject.id)
47
47
  end
48
48
 
49
49
  it "starts a recording via AMI, using the component ID as the filename" do
50
50
  filename = "#{Record::RECORDING_BASE_PATH}/#{subject.id}"
51
- ami_client.should_receive(:send_action).once.with('Monitor', 'Channel' => channel, 'File' => filename, 'Format' => 'wav', 'Mix' => true)
51
+ expect(ami_client).to receive(:send_action).once.with('Monitor', 'Channel' => channel, 'File' => filename, 'Format' => 'wav', 'Mix' => true)
52
52
  subject.execute
53
53
  end
54
54
 
55
55
  it "sends a max duration complete event when the recording ends" do
56
56
  full_filename = "file://#{Record::RECORDING_BASE_PATH}/#{subject.id}.wav"
57
- ami_client.should_receive(:send_action)
57
+ expect(ami_client).to receive(:send_action)
58
58
  subject.execute
59
59
  monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
60
60
  mock_call.process_ami_event monitor_stop_event
61
- reason.should be_a Punchblock::Component::Record::Complete::MaxDuration
62
- recording.uri.should be == full_filename
63
- original_command.should be_complete
61
+ expect(reason).to be_a Punchblock::Component::Record::Complete::MaxDuration
62
+ expect(recording.uri).to eq(full_filename)
63
+ expect(original_command).to be_complete
64
64
  end
65
65
 
66
66
  it "can be called multiple times on the same call" do
67
- ami_client.should_receive(:send_action).twice
67
+ expect(ami_client).to receive(:send_action).twice
68
68
  subject.execute
69
69
 
70
70
  monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
@@ -80,28 +80,28 @@ module Punchblock
80
80
  context "set to nil" do
81
81
  let(:command_options) { { :start_paused => nil } }
82
82
  it "should execute normally" do
83
- ami_client.should_receive(:send_action).once
83
+ expect(ami_client).to receive(:send_action).once
84
84
  subject.execute
85
- original_command.response(0.1).should be_a Ref
85
+ expect(original_command.response(0.1)).to be_a Ref
86
86
  end
87
87
  end
88
88
 
89
89
  context "set to false" do
90
90
  let(:command_options) { { :start_paused => false } }
91
91
  it "should execute normally" do
92
- ami_client.should_receive(:send_action).once
92
+ expect(ami_client).to receive(:send_action).once
93
93
  subject.execute
94
- original_command.response(0.1).should be_a Ref
94
+ expect(original_command.response(0.1)).to be_a Ref
95
95
  end
96
96
  end
97
97
 
98
98
  context "set to true" do
99
99
  let(:command_options) { { :start_paused => true } }
100
100
  it "should return an error and not execute any actions" do
101
- mock_call.should_receive(:execute_agi_command).never
101
+ expect(mock_call).to receive(:execute_agi_command).never
102
102
  subject.execute
103
103
  error = ProtocolError.new.setup 'option error', 'A start-paused value of true is unsupported.'
104
- original_command.response(0.1).should be == error
104
+ expect(original_command.response(0.1)).to eq(error)
105
105
  end
106
106
  end
107
107
  end
@@ -110,28 +110,28 @@ module Punchblock
110
110
  context "set to nil" do
111
111
  let(:command_options) { { :initial_timeout => nil } }
112
112
  it "should execute normally" do
113
- ami_client.should_receive(:send_action).once
113
+ expect(ami_client).to receive(:send_action).once
114
114
  subject.execute
115
- original_command.response(0.1).should be_a Ref
115
+ expect(original_command.response(0.1)).to be_a Ref
116
116
  end
117
117
  end
118
118
 
119
119
  context "set to -1" do
120
120
  let(:command_options) { { :initial_timeout => -1 } }
121
121
  it "should execute normally" do
122
- ami_client.should_receive(:send_action).once
122
+ expect(ami_client).to receive(:send_action).once
123
123
  subject.execute
124
- original_command.response(0.1).should be_a Ref
124
+ expect(original_command.response(0.1)).to be_a Ref
125
125
  end
126
126
  end
127
127
 
128
128
  context "set to a positive number" do
129
129
  let(:command_options) { { :initial_timeout => 10 } }
130
130
  it "should return an error and not execute any actions" do
131
- mock_call.should_receive(:execute_agi_command).never
131
+ expect(mock_call).to receive(:execute_agi_command).never
132
132
  subject.execute
133
133
  error = ProtocolError.new.setup 'option error', 'An initial-timeout value is unsupported.'
134
- original_command.response(0.1).should be == error
134
+ expect(original_command.response(0.1)).to eq(error)
135
135
  end
136
136
  end
137
137
  end
@@ -140,28 +140,28 @@ module Punchblock
140
140
  context "set to nil" do
141
141
  let(:command_options) { { :final_timeout => nil } }
142
142
  it "should execute normally" do
143
- ami_client.should_receive(:send_action).once
143
+ expect(ami_client).to receive(:send_action).once
144
144
  subject.execute
145
- original_command.response(0.1).should be_a Ref
145
+ expect(original_command.response(0.1)).to be_a Ref
146
146
  end
147
147
  end
148
148
 
149
149
  context "set to -1" do
150
150
  let(:command_options) { { :final_timeout => -1 } }
151
151
  it "should execute normally" do
152
- ami_client.should_receive(:send_action).once
152
+ expect(ami_client).to receive(:send_action).once
153
153
  subject.execute
154
- original_command.response(0.1).should be_a Ref
154
+ expect(original_command.response(0.1)).to be_a Ref
155
155
  end
156
156
  end
157
157
 
158
158
  context "set to a positive number" do
159
159
  let(:command_options) { { :final_timeout => 10 } }
160
160
  it "should return an error and not execute any actions" do
161
- mock_call.should_receive(:execute_agi_command).never
161
+ expect(mock_call).to receive(:execute_agi_command).never
162
162
  subject.execute
163
163
  error = ProtocolError.new.setup 'option error', 'A final-timeout value is unsupported.'
164
- original_command.response(0.1).should be == error
164
+ expect(original_command.response(0.1)).to eq(error)
165
165
  end
166
166
  end
167
167
  end
@@ -170,34 +170,34 @@ module Punchblock
170
170
  context "set to nil" do
171
171
  let(:command_options) { { :format => nil } }
172
172
  it "should execute as 'wav'" do
173
- ami_client.should_receive(:send_action).once.with('Monitor', hash_including('Format' => 'wav'))
173
+ expect(ami_client).to receive(:send_action).once.with('Monitor', hash_including('Format' => 'wav'))
174
174
  subject.execute
175
- original_command.response(0.1).should be_a Ref
175
+ expect(original_command.response(0.1)).to be_a Ref
176
176
  end
177
177
 
178
178
  it "provides the correct filename in the recording" do
179
- ami_client.should_receive(:send_action)
179
+ expect(ami_client).to receive(:send_action)
180
180
  subject.execute
181
181
  monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
182
182
  mock_call.process_ami_event monitor_stop_event
183
- recording.uri.should match(/.*\.wav$/)
183
+ expect(recording.uri).to match(/.*\.wav$/)
184
184
  end
185
185
  end
186
186
 
187
187
  context "set to 'mp3'" do
188
188
  let(:command_options) { { :format => 'mp3' } }
189
189
  it "should execute as 'mp3'" do
190
- ami_client.should_receive(:send_action).once.with('Monitor', hash_including('Format' => 'mp3'))
190
+ expect(ami_client).to receive(:send_action).once.with('Monitor', hash_including('Format' => 'mp3'))
191
191
  subject.execute
192
- original_command.response(0.1).should be_a Ref
192
+ expect(original_command.response(0.1)).to be_a Ref
193
193
  end
194
194
 
195
195
  it "provides the correct filename in the recording" do
196
- ami_client.should_receive(:send_action)
196
+ expect(ami_client).to receive(:send_action)
197
197
  subject.execute
198
198
  monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
199
199
  mock_call.process_ami_event monitor_stop_event
200
- recording.uri.should match(/.*\.mp3$/)
200
+ expect(recording.uri).to match(/.*\.mp3$/)
201
201
  end
202
202
  end
203
203
  end
@@ -206,20 +206,20 @@ module Punchblock
206
206
  context "set to nil" do
207
207
  let(:command_options) { { :start_beep => nil } }
208
208
  it "should execute normally" do
209
- mock_call.should_receive(:execute_agi_command).never.with('STREAM FILE', 'beep', '""')
210
- ami_client.should_receive(:send_action).once
209
+ expect(mock_call).to receive(:execute_agi_command).never.with('STREAM FILE', 'beep', '""')
210
+ expect(ami_client).to receive(:send_action).once
211
211
  subject.execute
212
- original_command.response(0.1).should be_a Ref
212
+ expect(original_command.response(0.1)).to be_a Ref
213
213
  end
214
214
  end
215
215
 
216
216
  context "set to false" do
217
217
  let(:command_options) { { :start_beep => false } }
218
218
  it "should execute normally" do
219
- mock_call.should_receive(:execute_agi_command).never.with('STREAM FILE', 'beep', '""')
220
- ami_client.should_receive(:send_action).once
219
+ expect(mock_call).to receive(:execute_agi_command).never.with('STREAM FILE', 'beep', '""')
220
+ expect(ami_client).to receive(:send_action).once
221
221
  subject.execute
222
- original_command.response(0.1).should be_a Ref
222
+ expect(original_command.response(0.1)).to be_a Ref
223
223
  end
224
224
  end
225
225
 
@@ -227,30 +227,30 @@ module Punchblock
227
227
  let(:command_options) { { :start_beep => true } }
228
228
 
229
229
  it "should play a beep before recording" do
230
- mock_call.should_receive(:execute_agi_command).once.with('STREAM FILE', 'beep', '""').ordered.and_return code: 200
231
- ami_client.should_receive(:send_action).once.ordered
230
+ expect(mock_call).to receive(:execute_agi_command).once.with('STREAM FILE', 'beep', '""').ordered.and_return code: 200
231
+ expect(ami_client).to receive(:send_action).once.ordered
232
232
  subject.execute
233
- original_command.response(0.1).should be_a Ref
233
+ expect(original_command.response(0.1)).to be_a Ref
234
234
  end
235
235
 
236
236
  context "when we get a RubyAMI Error" do
237
237
  it "should send an error response" do
238
238
  error = RubyAMI::Error.new.tap { |e| e.message = 'FooBar' }
239
- mock_call.should_receive(:execute_agi_command).and_raise error
240
- ami_client.should_receive(:send_action).never
239
+ expect(mock_call).to receive(:execute_agi_command).and_raise error
240
+ expect(ami_client).to receive(:send_action).never
241
241
  subject.execute
242
242
  error = ProtocolError.new.setup :platform_error, "Terminated due to AMI error 'FooBar'"
243
- original_command.response(0.1).should be == error
243
+ expect(original_command.response(0.1)).to eq(error)
244
244
  end
245
245
  end
246
246
 
247
247
  context "when the channel is no longer available" do
248
248
  it "should send an error complete event" do
249
- mock_call.should_receive(:execute_agi_command).and_raise ChannelGoneError
250
- ami_client.should_receive(:send_action).never
249
+ expect(mock_call).to receive(:execute_agi_command).and_raise ChannelGoneError
250
+ expect(ami_client).to receive(:send_action).never
251
251
  subject.execute
252
252
  error = ProtocolError.new.setup(:item_not_found, "Could not find a call with ID #{mock_call.id}", mock_call.id)
253
- original_command.response(0.1).should be == error
253
+ expect(original_command.response(0.1)).to eq(error)
254
254
  end
255
255
  end
256
256
  end
@@ -260,18 +260,18 @@ module Punchblock
260
260
  context "set to nil" do
261
261
  let(:command_options) { { :max_duration => nil } }
262
262
  it "should execute normally" do
263
- ami_client.should_receive(:send_action).once
263
+ expect(ami_client).to receive(:send_action).once
264
264
  subject.execute
265
- original_command.response(0.1).should be_a Ref
265
+ expect(original_command.response(0.1)).to be_a Ref
266
266
  end
267
267
  end
268
268
 
269
269
  context "set to -1" do
270
270
  let(:command_options) { { :max_duration => -1 } }
271
271
  it "should execute normally" do
272
- ami_client.should_receive(:send_action).once
272
+ expect(ami_client).to receive(:send_action).once
273
273
  subject.execute
274
- original_command.response(0.1).should be_a Ref
274
+ expect(original_command.response(0.1)).to be_a Ref
275
275
  end
276
276
  end
277
277
 
@@ -281,7 +281,7 @@ module Punchblock
281
281
  it "should return an error and not execute any actions" do
282
282
  subject.execute
283
283
  error = ProtocolError.new.setup 'option error', 'A max-duration value that is negative (and not -1) is invalid.'
284
- original_command.response(0.1).should be == error
284
+ expect(original_command.response(0.1)).to eq(error)
285
285
  end
286
286
  end
287
287
 
@@ -291,19 +291,19 @@ module Punchblock
291
291
  let(:command_options) { { :max_duration => 1000 } }
292
292
 
293
293
  it "executes a StopMonitor action" do
294
- ami_client.should_receive :send_action
295
- ami_client.should_receive(:send_action).once.with('StopMonitor', 'Channel' => channel)
294
+ expect(ami_client).to receive :send_action
295
+ expect(ami_client).to receive(:send_action).once.with('StopMonitor', 'Channel' => channel)
296
296
  subject.execute
297
297
  sleep 1.2
298
298
  end
299
299
 
300
300
  it "should not kill the translator if the channel is down" do
301
- ami_client.should_receive :send_action
301
+ expect(ami_client).to receive :send_action
302
302
  error = RubyAMI::Error.new.tap { |e| e.message = 'No such channel' }
303
- ami_client.should_receive(:send_action).once.with('StopMonitor', 'Channel' => channel).and_raise error
303
+ expect(ami_client).to receive(:send_action).once.with('StopMonitor', 'Channel' => channel).and_raise error
304
304
  subject.execute
305
305
  sleep 1.2
306
- translator.should be_alive
306
+ expect(translator).to be_alive
307
307
  end
308
308
 
309
309
  it "sends the correct complete event" do
@@ -314,9 +314,9 @@ module Punchblock
314
314
  monitor_stop_event = RubyAMI::Event.new 'MonitorStop', 'Channel' => channel
315
315
  mock_call.process_ami_event monitor_stop_event
316
316
 
317
- reason.should be_a Punchblock::Component::Record::Complete::MaxDuration
318
- recording.uri.should be == full_filename
319
- original_command.should be_complete
317
+ expect(reason).to be_a Punchblock::Component::Record::Complete::MaxDuration
318
+ expect(recording.uri).to eq(full_filename)
319
+ expect(original_command).to be_complete
320
320
  end
321
321
  end
322
322
  end
@@ -332,7 +332,7 @@ module Punchblock
332
332
  before { command.request! }
333
333
  it "returns a ProtocolError response" do
334
334
  subject.execute_command command
335
- command.response(0.1).should be_a ProtocolError
335
+ expect(command.response(0.1)).to be_a ProtocolError
336
336
  end
337
337
  end
338
338
 
@@ -340,8 +340,8 @@ module Punchblock
340
340
  let(:command) { Punchblock::Component::Stop.new }
341
341
 
342
342
  before do
343
- ami_client.should_receive :send_action
344
- mock_call.should_receive(:answered?).and_return(true)
343
+ expect(ami_client).to receive :send_action
344
+ expect(mock_call).to receive(:answered?).and_return(true)
345
345
  command.request!
346
346
  original_command.request!
347
347
  subject.execute
@@ -353,26 +353,26 @@ module Punchblock
353
353
  end
354
354
 
355
355
  it "sets the command response to true" do
356
- ami_client.should_receive :send_action
356
+ expect(ami_client).to receive :send_action
357
357
  subject.execute_command command
358
358
  send_stop_event
359
- command.response(0.1).should be == true
359
+ expect(command.response(0.1)).to eq(true)
360
360
  end
361
361
 
362
362
  it "executes a StopMonitor action" do
363
- ami_client.should_receive(:send_action).once.with('StopMonitor', 'Channel' => channel)
363
+ expect(ami_client).to receive(:send_action).once.with('StopMonitor', 'Channel' => channel)
364
364
  subject.execute_command command
365
365
  end
366
366
 
367
367
  it "sends the correct complete event" do
368
- ami_client.should_receive(:send_action).and_return RubyAMI::Response.new
368
+ expect(ami_client).to receive(:send_action).and_return RubyAMI::Response.new
369
369
 
370
370
  full_filename = "file://#{Record::RECORDING_BASE_PATH}/#{subject.id}.wav"
371
371
  subject.execute_command command
372
372
  send_stop_event
373
- reason.should be_a Punchblock::Event::Complete::Stop
374
- recording.uri.should be == full_filename
375
- original_command.should be_complete
373
+ expect(reason).to be_a Punchblock::Event::Complete::Stop
374
+ expect(recording.uri).to eq(full_filename)
375
+ expect(original_command).to be_complete
376
376
  end
377
377
  end
378
378
 
@@ -386,13 +386,13 @@ module Punchblock
386
386
  end
387
387
 
388
388
  it "sets the command response to true" do
389
- ami_client.should_receive(:send_action).and_return RubyAMI::Response.new
389
+ expect(ami_client).to receive(:send_action).and_return RubyAMI::Response.new
390
390
  subject.execute_command command
391
- command.response(0.1).should be == true
391
+ expect(command.response(0.1)).to eq(true)
392
392
  end
393
393
 
394
394
  it "pauses the recording via AMI" do
395
- ami_client.should_receive(:send_action).once.with('PauseMonitor', 'Channel' => channel)
395
+ expect(ami_client).to receive(:send_action).once.with('PauseMonitor', 'Channel' => channel)
396
396
  subject.execute_command command
397
397
  end
398
398
  end
@@ -407,13 +407,13 @@ module Punchblock
407
407
  end
408
408
 
409
409
  it "sets the command response to true" do
410
- ami_client.should_receive(:send_action).and_return RubyAMI::Response.new
410
+ expect(ami_client).to receive(:send_action).and_return RubyAMI::Response.new
411
411
  subject.execute_command command
412
- command.response(0.1).should be == true
412
+ expect(command.response(0.1)).to eq(true)
413
413
  end
414
414
 
415
415
  it "resumes the recording via AMI" do
416
- ami_client.should_receive(:send_action).once.with('ResumeMonitor', 'Channel' => channel)
416
+ expect(ami_client).to receive(:send_action).once.with('ResumeMonitor', 'Channel' => channel)
417
417
  subject.execute_command command
418
418
  end
419
419
  end
@@ -29,7 +29,7 @@ module Punchblock
29
29
  before { command.request! }
30
30
  it "returns a ProtocolError response" do
31
31
  subject.execute_command command
32
- command.response(0.1).should be_a ProtocolError
32
+ expect(command.response(0.1)).to be_a ProtocolError
33
33
  end
34
34
  end
35
35
 
@@ -41,22 +41,22 @@ module Punchblock
41
41
  end
42
42
 
43
43
  it "sets the command response to true" do
44
- mock_call.should_receive(:redirect_back)
45
- mock_call.should_receive(:register_handler).with do |type, *guards|
46
- type.should be == :ami
47
- guards.should have(2).guards
48
- guards[0].should be_a Proc
49
- guards[1].should be == {:name => 'AsyncAGI'}
50
- end
44
+ expect(mock_call).to receive(:redirect_back)
45
+ expect(mock_call).to receive(:register_handler).with { |type, *guards|
46
+ expect(type).to eq(:ami)
47
+ expect(guards.size).to eq(2)
48
+ expect(guards[0]).to be_a Proc
49
+ expect(guards[1]).to eq({:name => 'AsyncAGI'})
50
+ }
51
51
 
52
52
  subject.execute_command command
53
- command.response(0.1).should be == true
53
+ expect(command.response(0.1)).to eq(true)
54
54
  end
55
55
 
56
56
  it "returns an error if the component is already complete" do
57
57
  subject.set_complete
58
58
  subject.execute_command command
59
- command.response(0.1).should be_a ProtocolError
59
+ expect(command.response(0.1)).to be_a ProtocolError
60
60
  end
61
61
  end
62
62
  end