adhearsion 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +3 -0
  4. data/LICENSE +1 -1
  5. data/README.markdown +2 -2
  6. data/adhearsion.gemspec +0 -1
  7. data/lib/adhearsion/punchblock_plugin/initializer.rb +1 -1
  8. data/lib/adhearsion/version.rb +1 -1
  9. data/spec/adhearsion/call_controller/dial_spec.rb +56 -57
  10. data/spec/adhearsion/call_controller/input_spec.rb +11 -16
  11. data/spec/adhearsion/call_controller/menu_dsl/menu_builder_spec.rb +6 -6
  12. data/spec/adhearsion/call_controller/menu_dsl/menu_spec.rb +10 -10
  13. data/spec/adhearsion/call_controller/output/async_player_spec.rb +3 -3
  14. data/spec/adhearsion/call_controller/output/player_spec.rb +1 -1
  15. data/spec/adhearsion/call_controller/output_spec.rb +2 -7
  16. data/spec/adhearsion/call_controller/record_spec.rb +11 -18
  17. data/spec/adhearsion/call_controller_spec.rb +35 -35
  18. data/spec/adhearsion/call_spec.rb +49 -35
  19. data/spec/adhearsion/calls_spec.rb +2 -2
  20. data/spec/adhearsion/console_spec.rb +22 -23
  21. data/spec/adhearsion/events_spec.rb +3 -3
  22. data/spec/adhearsion/initializer_spec.rb +33 -35
  23. data/spec/adhearsion/logging_spec.rb +3 -3
  24. data/spec/adhearsion/outbound_call_spec.rb +21 -19
  25. data/spec/adhearsion/plugin_spec.rb +9 -11
  26. data/spec/adhearsion/process_spec.rb +15 -14
  27. data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +37 -42
  28. data/spec/adhearsion/punchblock_plugin_spec.rb +2 -2
  29. data/spec/adhearsion/router/evented_route_spec.rb +1 -1
  30. data/spec/adhearsion/router/openended_route_spec.rb +5 -5
  31. data/spec/adhearsion/router/route_spec.rb +9 -9
  32. data/spec/adhearsion/router/unaccepting_route_spec.rb +6 -6
  33. data/spec/adhearsion/router_spec.rb +8 -8
  34. data/spec/adhearsion/statistics_spec.rb +1 -1
  35. data/spec/adhearsion_spec.rb +1 -1
  36. data/spec/spec_helper.rb +1 -2
  37. data/spec/support/call_controller_test_helpers.rb +11 -8
  38. data/spec/support/initializer_stubs.rb +1 -1
  39. data/spec/support/punchblock_mocks.rb +3 -2
  40. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14d65bdfc20111980b8445acf33c5a6d18ba166a
4
- data.tar.gz: c10a07432dec071a4cdcf8e508517c4e2717cf62
3
+ metadata.gz: bb14c1255a1538690eeda472f1eb7ca04b8fc9d6
4
+ data.tar.gz: 1d44d386568202e8250ab989f2d3fa76d9ada702
5
5
  SHA512:
6
- metadata.gz: 2ecd96983d91e8e5da635158cb07537b18179958ea3e148c37086d4ab8e8b0099b3237407bae8aa33d644bef1ae0db7592ea083be58a7296bd7963716505131b
7
- data.tar.gz: 3d2f040a64a072c7271690b5582e476b35e7449d7ce92be633e06bf0beb554853333e684efaec6db371a4a786eda5cb70f9f0abb6b47d42c869b81c2e86114dc
6
+ metadata.gz: cfb2b6fe75db610496304c8de2ccb4b81a004c8820d2998758a0a5b2f2742ea4a47f0082f847ad9da33f4f7247ab0396e7c550447f857326a976226210246e27
7
+ data.tar.gz: 2f3dc960267aead3512dcafcf44b5db6e239d35f58f74133f5d9592876941b2dbeef2af8f457a9b6b39291b22cc51672a99262862e8a5969bd92086ce3c20ff8
@@ -3,6 +3,7 @@ script: bundle exec rake --trace
3
3
  rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
+ - 2.0.0
6
7
  - jruby-19mode
7
8
  - rbx-19mode
8
9
  - ruby-head
@@ -1,5 +1,8 @@
1
1
  # [develop](https://github.com/adhearsion/adhearsion)
2
2
 
3
+ # [2.3.1](https://github.com/adhearsion/adhearsion/compare/v2.3.0...v2.3.1) - [2013-03-28](https://rubygems.org/gems/adhearsion/versions/2.3.1)
4
+ * Bugfix: Fix a leftover Celluloid deprecation warning
5
+
3
6
  # [2.3.0](https://github.com/adhearsion/adhearsion/compare/v2.2.1...v2.3.0) - [2013-03-25](https://rubygems.org/gems/adhearsion/versions/2.3.0)
4
7
  * Feature: Allow specifying a renderer per invocation of `#menu`, `#interruptible_play`, `#ask`, `#play` and `#play!`
5
8
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2012 Adhearsion Foundation Inc
1
+ Copyright (C) 2013 Adhearsion Foundation Inc
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -2,7 +2,7 @@
2
2
 
3
3
  Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and **call into their code**.
4
4
 
5
- Adhearsion rests above a lower-level telephony platform, for example [Asterisk](http://asterisk.org) or [Voxeo PRISM](http://voxeolabs.com/prism/), and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).
5
+ Adhearsion rests above a lower-level telephony platform, for example [Asterisk](http://asterisk.org), [FreeSWTICH](http://freeswitch.org) or [Voxeo PRISM](http://voxeolabs.com/prism/), and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).
6
6
 
7
7
  ## Features
8
8
 
@@ -66,4 +66,4 @@ There is a pre-commit hook that runs encoding checks available in pre-commit. To
66
66
 
67
67
  ### Copyright
68
68
 
69
- Copyright (c) 2012 Adhearsion Foundation Inc. MIT LICENSE (see LICENSE for details).
69
+ Copyright (c) 2013 Adhearsion Foundation Inc. MIT LICENSE (see LICENSE for details).
@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency 'aruba', "~> 0.4"
39
39
  s.add_development_dependency 'ci_reporter'
40
40
  s.add_development_dependency 'cucumber'
41
- s.add_development_dependency 'flexmock'
42
41
  s.add_development_dependency 'guard-cucumber'
43
42
  s.add_development_dependency 'guard-rspec'
44
43
  s.add_development_dependency 'rspec', ["~> 2.11"]
@@ -150,7 +150,7 @@ module Adhearsion
150
150
 
151
151
  def dispatch_call_event(event)
152
152
  if call = Adhearsion.active_calls[event.target_call_id]
153
- call.deliver_message! event
153
+ call.async.deliver_message event
154
154
  else
155
155
  logger.error "Event received for inactive call #{event.target_call_id}: #{event.inspect}"
156
156
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Adhearsion
4
- VERSION = '2.3.0'
4
+ VERSION = '2.3.1'
5
5
  end
@@ -9,28 +9,29 @@ module Adhearsion
9
9
 
10
10
  let(:to) { 'sip:foo@bar.com' }
11
11
  let(:other_call_id) { new_uuid }
12
- let(:other_mock_call) { flexmock OutboundCall.new, :id => other_call_id, :write_command => true }
12
+ let(:other_mock_call) { OutboundCall.new }
13
13
 
14
14
  let(:second_to) { 'sip:baz@bar.com' }
15
15
  let(:second_other_call_id) { new_uuid }
16
- let(:second_other_mock_call) { flexmock OutboundCall.new, :id => second_other_call_id, :write_command => true }
16
+ let(:second_other_mock_call) { OutboundCall.new }
17
17
 
18
18
  let(:mock_answered) { Punchblock::Event::Answered.new }
19
19
 
20
20
  let(:latch) { CountDownLatch.new 1 }
21
21
 
22
+ before do
23
+ other_mock_call.stub id: other_call_id, write_command: true
24
+ second_other_mock_call.stub id: second_other_call_id, write_command: true
25
+ end
26
+
22
27
  def mock_end(reason = :hangup)
23
- flexmock Punchblock::Event::End.new, :reason => reason
28
+ Punchblock::Event::End.new.tap { |event| event.stub reason: reason }
24
29
  end
25
30
 
26
31
  describe "#dial" do
27
- before do
28
- other_mock_call
29
- end
30
-
31
32
  it "should dial the call to the correct endpoint and return a dial status object" do
32
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
33
- flexmock(other_mock_call).should_receive(:dial).with(to, :from => 'foo').once
33
+ OutboundCall.should_receive(:new).and_return other_mock_call
34
+ other_mock_call.should_receive(:dial).with(to, :from => 'foo').once
34
35
  dial_thread = Thread.new do
35
36
  subject.dial(to, :from => 'foo').should be_a Dial::DialStatus
36
37
  end
@@ -40,9 +41,9 @@ module Adhearsion
40
41
  end
41
42
 
42
43
  it "should default the caller ID to that of the original call" do
43
- flexmock call, :from => 'sip:foo@bar.com'
44
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
45
- flexmock(other_mock_call).should_receive(:dial).with(to, :from => 'sip:foo@bar.com').once
44
+ call.stub :from => 'sip:foo@bar.com'
45
+ OutboundCall.should_receive(:new).and_return other_mock_call
46
+ other_mock_call.should_receive(:dial).with(to, :from => 'sip:foo@bar.com').once
46
47
  dial_thread = Thread.new do
47
48
  subject.dial to
48
49
  end
@@ -63,9 +64,9 @@ module Adhearsion
63
64
 
64
65
  describe "without a block" do
65
66
  before do
66
- flexmock(other_mock_call).should_receive(:dial).once.with(to, options)
67
- flexmock(other_mock_call).should_receive(:hangup).once
68
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
67
+ other_mock_call.should_receive(:dial).once.with(to, options)
68
+ other_mock_call.should_receive(:hangup).once
69
+ OutboundCall.should_receive(:new).and_return other_mock_call
69
70
  end
70
71
 
71
72
  it "blocks the original controller until the new call ends" do
@@ -89,8 +90,8 @@ module Adhearsion
89
90
  end
90
91
 
91
92
  it "joins the new call to the existing one on answer" do
92
- flexmock(call).should_receive(:answer).once
93
- flexmock(other_mock_call).should_receive(:join).once.with(call)
93
+ call.should_receive(:answer).once
94
+ other_mock_call.should_receive(:join).once.with(call)
94
95
 
95
96
  dial_in_thread
96
97
 
@@ -103,8 +104,8 @@ module Adhearsion
103
104
  end
104
105
 
105
106
  it "hangs up the new call when the dial unblocks" do
106
- flexmock(call).should_receive(:answer).once
107
- flexmock(other_mock_call).should_receive(:join).once.with(call)
107
+ call.should_receive(:answer).once
108
+ other_mock_call.should_receive(:join).once.with(call)
108
109
 
109
110
  dial_in_thread
110
111
 
@@ -150,8 +151,8 @@ module Adhearsion
150
151
 
151
152
  context "when the call is answered and joined" do
152
153
  it "has an overall dial status of :answer" do
153
- flexmock(call).should_receive(:answer).once
154
- flexmock(other_mock_call).should_receive(:join).once.with(call)
154
+ call.should_receive(:answer).once
155
+ other_mock_call.should_receive(:join).once.with(call)
155
156
 
156
157
  t = dial_in_thread
157
158
 
@@ -179,7 +180,7 @@ module Adhearsion
179
180
  end
180
181
 
181
182
  it "should not make any outbound calls" do
182
- flexmock(OutboundCall).should_receive(:new).never
183
+ OutboundCall.should_receive(:new).never
183
184
  expect { subject.dial to, options }.to raise_error
184
185
  end
185
186
  end
@@ -190,16 +191,14 @@ module Adhearsion
190
191
  let(:second_other_options) { options }
191
192
 
192
193
  before do
193
- second_other_mock_call
194
-
195
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call, second_other_mock_call
194
+ OutboundCall.should_receive(:new).and_return other_mock_call, second_other_mock_call
196
195
 
197
- flexmock(other_mock_call).should_receive(:dial).once.with(to, other_options)
198
- flexmock(other_mock_call).should_receive(:hangup).once
196
+ other_mock_call.should_receive(:dial).once.with(to, other_options)
197
+ other_mock_call.should_receive(:hangup).once
199
198
 
200
- flexmock(second_other_mock_call).should_receive(:dial).once.with(second_to, second_other_options)
201
- flexmock(second_other_mock_call).should_receive(:join).never
202
- flexmock(second_other_mock_call).should_receive(:hangup).once
199
+ second_other_mock_call.should_receive(:dial).once.with(second_to, second_other_options)
200
+ second_other_mock_call.should_receive(:join).never
201
+ second_other_mock_call.should_receive(:hangup).once
203
202
  end
204
203
 
205
204
  def dial_in_thread
@@ -211,9 +210,9 @@ module Adhearsion
211
210
  end
212
211
 
213
212
  it "dials all parties and joins the first one to answer, hanging up the rest" do
214
- flexmock(call).should_receive(:answer).once
215
- flexmock(other_mock_call).should_receive(:join).once.with(call)
216
- flexmock(second_other_mock_call).should_receive(:hangup).once
213
+ call.should_receive(:answer).once
214
+ other_mock_call.should_receive(:join).once.with(call)
215
+ second_other_mock_call.should_receive(:hangup).once
217
216
 
218
217
  t = dial_in_thread
219
218
 
@@ -236,9 +235,9 @@ module Adhearsion
236
235
  end
237
236
 
238
237
  it "unblocks when the joined call unjoins, allowing it to proceed further" do
239
- flexmock(call).should_receive(:answer).once
240
- flexmock(other_mock_call).should_receive(:join).once.with(call)
241
- flexmock(second_other_mock_call).should_receive(:hangup).once
238
+ call.should_receive(:answer).once
239
+ other_mock_call.should_receive(:join).once.with(call)
240
+ second_other_mock_call.should_receive(:hangup).once
242
241
 
243
242
  t = dial_in_thread
244
243
 
@@ -349,9 +348,9 @@ module Adhearsion
349
348
 
350
349
  context "when a call is answered and joined, and the other ends with an error" do
351
350
  it "has an overall dial status of :answer" do
352
- flexmock(call).should_receive(:answer).once
353
- flexmock(other_mock_call).should_receive(:join).once.with(call)
354
- flexmock(second_other_mock_call).should_receive(:hangup).once
351
+ call.should_receive(:answer).once
352
+ other_mock_call.should_receive(:join).once.with(call)
353
+ second_other_mock_call.should_receive(:hangup).once
355
354
 
356
355
  t = dial_in_thread
357
356
 
@@ -375,9 +374,9 @@ module Adhearsion
375
374
  let(:timeout) { 3 }
376
375
 
377
376
  it "should abort the dial after the specified timeout" do
378
- flexmock(other_mock_call).should_receive(:dial).once
379
- flexmock(other_mock_call).should_receive(:hangup).once
380
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
377
+ other_mock_call.should_receive(:dial).once
378
+ other_mock_call.should_receive(:hangup).once
379
+ OutboundCall.should_receive(:new).and_return other_mock_call
381
380
 
382
381
  time = Time.now
383
382
 
@@ -397,11 +396,11 @@ module Adhearsion
397
396
 
398
397
  describe "if someone answers before the timeout elapses" do
399
398
  it "should not abort until the far end hangs up" do
400
- flexmock(other_mock_call).should_receive(:dial).once.with(to, hsh(:timeout => timeout))
401
- flexmock(call).should_receive(:answer).once
402
- flexmock(other_mock_call).should_receive(:join).once.with(call)
403
- flexmock(other_mock_call).should_receive(:hangup).once
404
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
399
+ other_mock_call.should_receive(:dial).once.with(to, hash_including(:timeout => timeout))
400
+ call.should_receive(:answer).once
401
+ other_mock_call.should_receive(:join).once.with(call)
402
+ other_mock_call.should_receive(:hangup).once
403
+ OutboundCall.should_receive(:new).and_return other_mock_call
405
404
 
406
405
  time = Time.now
407
406
 
@@ -451,15 +450,15 @@ module Adhearsion
451
450
  let(:options) { {:confirm => confirmation_controller} }
452
451
 
453
452
  before do
454
- flexmock(other_mock_call).should_receive(:dial).once
455
- flexmock(OutboundCall).should_receive(:new).and_return other_mock_call
453
+ other_mock_call.should_receive(:dial).once
454
+ OutboundCall.should_receive(:new).and_return other_mock_call
456
455
  end
457
456
 
458
457
  context "with confirmation controller metadata specified" do
459
458
  let(:options) { {:confirm => confirmation_controller, :confirm_metadata => {:foo => 'bar'}} }
460
459
 
461
460
  it "should set the metadata on the controller" do
462
- flexmock(other_mock_call).should_receive(:hangup).twice.and_return do
461
+ other_mock_call.should_receive(:hangup).twice.and_return do
463
462
  other_mock_call << mock_end
464
463
  end
465
464
  other_mock_call['confirm'] = false
@@ -479,7 +478,7 @@ module Adhearsion
479
478
 
480
479
  context "when an outbound call is answered" do
481
480
  it "should execute the specified confirmation controller" do
482
- flexmock(other_mock_call).should_receive(:hangup).twice.and_return do
481
+ other_mock_call.should_receive(:hangup).twice.and_return do
483
482
  other_mock_call << mock_end
484
483
  end
485
484
  other_mock_call['confirm'] = false
@@ -495,10 +494,10 @@ module Adhearsion
495
494
  end
496
495
 
497
496
  it "should join the calls if the call is still active after execution of the call controller" do
498
- flexmock(other_mock_call).should_receive(:hangup).once
497
+ other_mock_call.should_receive(:hangup).once
499
498
  other_mock_call['confirm'] = true
500
- flexmock(call).should_receive(:answer).once
501
- flexmock(other_mock_call).should_receive(:join).once.with(call)
499
+ call.should_receive(:answer).once
500
+ other_mock_call.should_receive(:join).once.with(call)
502
501
 
503
502
  t = dial_in_thread
504
503
 
@@ -515,12 +514,12 @@ module Adhearsion
515
514
  end
516
515
 
517
516
  it "should not join the calls if the call is not active after execution of the call controller" do
518
- flexmock(other_mock_call).should_receive(:hangup).twice.and_return do
517
+ other_mock_call.should_receive(:hangup).twice.and_return do
519
518
  other_mock_call << mock_end
520
519
  end
521
520
  other_mock_call['confirm'] = false
522
- flexmock(call).should_receive(:answer).never
523
- flexmock(other_mock_call).should_receive(:join).never.with(call)
521
+ call.should_receive(:answer).never
522
+ other_mock_call.should_receive(:join).never.with(call)
524
523
 
525
524
  t = dial_in_thread
526
525
 
@@ -87,12 +87,7 @@ module Adhearsion
87
87
  let(:utterance) { 'dtmf-5' }
88
88
 
89
89
  def expect_component_complete_event
90
- complete_event = Punchblock::Event::Complete.new
91
- flexmock(complete_event).should_receive(:reason => flexmock(:utterance => utterance, :name => :input))
92
- flexmock(Punchblock::Component::Input).new_instances do |input|
93
- input.should_receive(:complete?).and_return(false)
94
- input.should_receive(:complete_event).and_return(complete_event)
95
- end
90
+ expect_input_component_complete_event utterance
96
91
  end
97
92
 
98
93
  it "sends the correct input component" do
@@ -103,7 +98,7 @@ module Adhearsion
103
98
 
104
99
  it "returns the correct pressed digit" do
105
100
  expect_component_complete_event
106
- subject.should_receive(:execute_component_and_await_completion).once.with(Punchblock::Component::Input).and_return input_component
101
+ subject.should_receive(:execute_component_and_await_completion).once.with(kind_of(Punchblock::Component::Input)).and_return input_component
107
102
  subject.wait_for_digit(timeout).should be == '5'
108
103
  end
109
104
 
@@ -112,7 +107,7 @@ module Adhearsion
112
107
 
113
108
  it "returns the correct pressed digit" do
114
109
  expect_component_complete_event
115
- subject.should_receive(:execute_component_and_await_completion).once.with(Punchblock::Component::Input).and_return input_component
110
+ subject.should_receive(:execute_component_and_await_completion).once.with(kind_of(Punchblock::Component::Input)).and_return input_component
116
111
  subject.wait_for_digit(timeout).should be == '5'
117
112
  end
118
113
  end
@@ -130,13 +125,13 @@ module Adhearsion
130
125
  end # wait_for_digit
131
126
 
132
127
  describe "#jump_to" do
133
- let(:match_object) { flexmock(Class.new) }
128
+ let(:match_object) { Class.new }
134
129
  let(:overrides) { Hash.new(:extension => "1") }
135
130
  let(:block) { Proc.new {} }
136
131
 
137
132
  it "calls instance_exec if the match object has a block" do
138
- match_object.should_receive(:block).and_return(block)
139
- subject.should_receive(:instance_exec).with(overrides[:extension], block)
133
+ match_object.stub(:block => block)
134
+ subject.should_receive(:instance_exec).with(overrides[:extension], &block)
140
135
  subject.jump_to(match_object, overrides)
141
136
  end
142
137
 
@@ -167,8 +162,8 @@ module Adhearsion
167
162
  let(:response) { '1234' }
168
163
 
169
164
  before do
170
- flexmock menu_instance, :status => status, :result => response
171
- flexmock(MenuDSL::Menu).should_receive(:new).and_return(menu_instance)
165
+ menu_instance.stub :status => status, :result => response
166
+ MenuDSL::Menu.should_receive(:new).and_return(menu_instance)
172
167
  end
173
168
 
174
169
  it "exits the function if MenuResultDone" do
@@ -272,8 +267,8 @@ module Adhearsion
272
267
  let(:result_found) { MenuDSL::Menu::MenuResultFound.new(:match_object, :new_extension) }
273
268
 
274
269
  before do
275
- flexmock menu_instance
276
- flexmock(MenuDSL::Menu).should_receive(:new).and_return(menu_instance)
270
+ menu_instance
271
+ MenuDSL::Menu.should_receive(:new).and_return(menu_instance)
277
272
  end
278
273
 
279
274
  it "exits the function if MenuResultDone" do
@@ -298,7 +293,7 @@ module Adhearsion
298
293
  end
299
294
 
300
295
  it "plays audio, then executes timeout hook if input times out" do
301
- menu_instance.should_receive(:continue).and_return(result_get_another_or_timeout, result_done)
296
+ menu_instance.should_receive(:continue).and_return(result_get_another_or_timeout)
302
297
  subject.should_receive(:play_sound_files_for_menu).once.with(menu_instance, sound_files).and_return(nil)
303
298
  result = subject.ask sound_files
304
299
  result.menu.should be menu_instance
@@ -11,7 +11,7 @@ module Adhearsion
11
11
 
12
12
  describe "#build" do
13
13
  it "sets the context and instance_eval's the block" do
14
- flexmock(subject).should_receive(:foo).with(:bar)
14
+ subject.should_receive(:foo).with(:bar)
15
15
  subject.build do
16
16
  foo :bar
17
17
  end
@@ -34,18 +34,18 @@ module Adhearsion
34
34
  end
35
35
 
36
36
  it "creates a pattern based on a payload" do
37
- flexmock(MenuDSL::MatchCalculator).should_receive(:build_with_pattern).with("1", Object)
37
+ MenuDSL::MatchCalculator.should_receive(:build_with_pattern).with("1", Object)
38
38
  subject.match "1", Object
39
39
  end
40
40
 
41
41
  it "creates a pattern based on a block" do
42
- flexmock(MenuDSL::MatchCalculator).should_receive(:build_with_pattern).with("1", nil, match_block)
42
+ MenuDSL::MatchCalculator.should_receive(:build_with_pattern).with("1", nil, &match_block)
43
43
  subject.match("1", &match_block)
44
44
  end
45
45
 
46
46
  it "creates multiple patterns if multiple arguments are passed in" do
47
- flexmock(MenuDSL::MatchCalculator).should_receive(:build_with_pattern).with(1, Object)
48
- flexmock(MenuDSL::MatchCalculator).should_receive(:build_with_pattern).with(2, Object)
47
+ MenuDSL::MatchCalculator.should_receive(:build_with_pattern).with(1, Object)
48
+ MenuDSL::MatchCalculator.should_receive(:build_with_pattern).with(2, Object)
49
49
  subject.match(1, 2, Object)
50
50
  end
51
51
  end#match
@@ -68,7 +68,7 @@ module Adhearsion
68
68
  let(:expected_pattern) { MenuDSL::MatchCalculator.build_with_pattern("1", Object) }
69
69
 
70
70
  it "returns the generated patterns" do
71
- flexmock(MenuDSL::MatchCalculator).should_receive(:build_with_pattern).with("1", Object).and_return(expected_pattern)
71
+ MenuDSL::MatchCalculator.should_receive(:build_with_pattern).with("1", Object).at_least(:once).and_return(expected_pattern)
72
72
  subject.match("1", Object)
73
73
  subject.weighted_match_calculators.should be == [expected_pattern]
74
74
  end
@@ -153,8 +153,8 @@ module Adhearsion
153
153
  its(:builder) { should be_a MenuBuilder }
154
154
 
155
155
  it "should evaluate the block on the builder object" do
156
- mock_menu_builder = flexmock(MenuBuilder.new)
157
- flexmock(MenuBuilder).should_receive(:new).and_return(mock_menu_builder)
156
+ mock_menu_builder = MenuBuilder.new
157
+ MenuBuilder.should_receive(:new).and_return(mock_menu_builder)
158
158
  mock_menu_builder.should_receive(:match).once.with(1)
159
159
  Menu.new { match 1 }
160
160
  end
@@ -212,8 +212,8 @@ module Adhearsion
212
212
 
213
213
  describe "#execute_invalid_hook" do
214
214
  it "calls the builder's execute_hook_for with :invalid" do
215
- mock_menu_builder = flexmock(MenuBuilder.new)
216
- flexmock(MenuBuilder).should_receive(:new).and_return(mock_menu_builder)
215
+ mock_menu_builder = MenuBuilder.new
216
+ MenuBuilder.should_receive(:new).and_return(mock_menu_builder)
217
217
  mock_menu_builder.should_receive(:execute_hook_for).with(:invalid, "")
218
218
  menu_instance = Menu.new
219
219
  menu_instance.execute_invalid_hook
@@ -222,8 +222,8 @@ module Adhearsion
222
222
 
223
223
  describe "#execute_timeout_hook" do
224
224
  it "calls the builder's execute_hook_for with :timeout" do
225
- mock_menu_builder = flexmock(MenuBuilder.new)
226
- flexmock(MenuBuilder).should_receive(:new).and_return(mock_menu_builder)
225
+ mock_menu_builder = MenuBuilder.new
226
+ MenuBuilder.should_receive(:new).and_return(mock_menu_builder)
227
227
  mock_menu_builder.should_receive(:execute_hook_for).with(:timeout, "")
228
228
  menu_instance = Menu.new
229
229
  menu_instance.execute_timeout_hook
@@ -232,8 +232,8 @@ module Adhearsion
232
232
 
233
233
  describe "#execute_failure_hook" do
234
234
  it "calls the builder's execute_hook_for with :failure" do
235
- mock_menu_builder = flexmock(MenuBuilder.new)
236
- flexmock(MenuBuilder).should_receive(:new).and_return(mock_menu_builder)
235
+ mock_menu_builder = MenuBuilder.new
236
+ MenuBuilder.should_receive(:new).and_return(mock_menu_builder)
237
237
  mock_menu_builder.should_receive(:execute_hook_for).with(:failure, "")
238
238
  menu_instance = Menu.new
239
239
  menu_instance.execute_failure_hook
@@ -242,8 +242,8 @@ module Adhearsion
242
242
 
243
243
  describe "#execute_validator_hook" do
244
244
  it "calls the builder's execute_hook_for with :validator" do
245
- mock_menu_builder = flexmock(MenuBuilder.new)
246
- flexmock(MenuBuilder).should_receive(:new).and_return(mock_menu_builder)
245
+ mock_menu_builder = MenuBuilder.new
246
+ MenuBuilder.should_receive(:new).and_return(mock_menu_builder)
247
247
  mock_menu_builder.should_receive(:execute_hook_for).with(:validator, "")
248
248
  menu_instance = Menu.new
249
249
  menu_instance.execute_validator_hook