adhearsion 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -18,31 +18,31 @@ module Adhearsion
18
18
 
19
19
  let(:latch) { CountDownLatch.new 1 }
20
20
 
21
- before { flexmock(call.wrapped_object).should_receive :write_and_await_response }
21
+ before { call.wrapped_object.stub :write_and_await_response }
22
22
 
23
23
  context "via a call controller" do
24
24
  let(:controller) { CallController }
25
25
  subject(:route) { Route.new 'foobar', controller }
26
26
 
27
27
  it "should not accept the call" do
28
- flexmock(call).should_receive(:accept).never
28
+ call.should_receive(:accept).never
29
29
  route.dispatch call, lambda { latch.countdown! }
30
30
  latch.wait(2).should be true
31
31
  end
32
32
 
33
33
  it "should instruct the call to use an instance of the controller" do
34
- flexmock(call).should_receive(:execute_controller).once.with controller, Proc
34
+ call.should_receive(:execute_controller).once.with kind_of(controller), kind_of(Proc)
35
35
  route.dispatch call
36
36
  end
37
37
 
38
38
  it "should hangup the call after all controllers have executed" do
39
- flexmock(call).should_receive(:hangup).once
39
+ call.should_receive(:hangup).once
40
40
  route.dispatch call, lambda { latch.countdown! }
41
41
  latch.wait(2).should be true
42
42
  end
43
43
 
44
44
  context "if hangup raises a Call::Hangup" do
45
- before { flexmock(call).should_receive(:hangup).once.and_raise Call::Hangup }
45
+ before { call.should_receive(:hangup).once.and_raise Call::Hangup }
46
46
 
47
47
  it "should not raise an exception" do
48
48
  lambda do
@@ -61,7 +61,7 @@ module Adhearsion
61
61
  end
62
62
 
63
63
  it "should instruct the call to use a CallController with the correct block" do
64
- flexmock(call).should_receive(:execute_controller).once.with(CallController, Proc).and_return do |controller|
64
+ call.should_receive(:execute_controller).once.with(kind_of(CallController), kind_of(Proc)).and_return do |controller|
65
65
  controller.block.call.should be == :foobar
66
66
  end
67
67
  route.dispatch call
@@ -9,6 +9,9 @@ module Adhearsion
9
9
  describe 'a new router' do
10
10
  subject { Router.new {} }
11
11
 
12
+ let(:call) { mock 'Adhearsion::Call' }
13
+ before { call.stub id: 'abc123' }
14
+
12
15
  it "should make the router available to the block" do
13
16
  foo = nil
14
17
  Router.new do
@@ -150,17 +153,17 @@ module Adhearsion
150
153
  subject { router.match call }
151
154
 
152
155
  context 'with a call from fred' do
153
- let(:call) { flexmock 'Adhearsion::Call', :from => 'fred' }
156
+ before { call.stub :from => 'fred' }
154
157
  its(:name) { should be == 'calls from fred' }
155
158
  end
156
159
 
157
160
  context 'with a call from paul' do
158
- let(:call) { flexmock 'Adhearsion::Call', :from => 'paul' }
161
+ before { call.stub :from => 'paul' }
159
162
  its(:name) { should be == 'calls from paul' }
160
163
  end
161
164
 
162
165
  context 'with a call from frank' do
163
- let(:call) { flexmock 'Adhearsion::Call', :from => 'frank' }
166
+ before { call.stub :from => 'frank' }
164
167
  its(:name) { should be == 'catchall' }
165
168
  end
166
169
  end
@@ -172,11 +175,10 @@ module Adhearsion
172
175
  end
173
176
  end
174
177
 
175
- let(:call) { flexmock 'Adhearsion::Call', :id => 'abc123' }
176
178
  let(:route) { subject.routes.first }
177
179
 
178
180
  it "should dispatch via the route" do
179
- flexmock(route).should_receive(:dispatch).once.with call
181
+ route.should_receive(:dispatch).once.with call
180
182
  subject.handle call
181
183
  end
182
184
 
@@ -185,8 +187,6 @@ module Adhearsion
185
187
  Router.new {}
186
188
  end
187
189
 
188
- let(:call) { flexmock 'Adhearsion::Call', :id => 'abc123' }
189
-
190
190
  it "should return a dispatcher which rejects the call as an error" do
191
191
  call.should_receive(:reject).once.with(:error)
192
192
  subject.handle call
@@ -200,7 +200,7 @@ module Adhearsion
200
200
  end
201
201
  end
202
202
 
203
- let(:call) { flexmock 'Adhearsion::Call', :id => 'abc123', :to => 'bar' }
203
+ before { call.stub to: 'bar' }
204
204
 
205
205
  it "should return a dispatcher which rejects the call as an error" do
206
206
  call.should_receive(:reject).once.with(:error)
@@ -11,7 +11,7 @@ describe Adhearsion::Statistics do
11
11
 
12
12
  before do
13
13
  Celluloid::Actor[:statistics] = described_class.new
14
- flexmock(Adhearsion.active_calls).should_receive(:count).and_return 0
14
+ Adhearsion.active_calls.stub count: 0
15
15
  end
16
16
 
17
17
  after do
@@ -41,7 +41,7 @@ describe Adhearsion do
41
41
 
42
42
  it "should execute a block" do
43
43
  foo = Object.new
44
- flexmock(foo).should_receive(:bar).once
44
+ foo.should_receive(:bar).once
45
45
  Adhearsion.config do |config|
46
46
  foo.bar
47
47
  end
@@ -20,7 +20,6 @@ end
20
20
 
21
21
  %w{
22
22
  bundler/setup
23
- flexmock/rspec
24
23
  active_support
25
24
  stringio
26
25
  countdownlatch
@@ -35,7 +34,7 @@ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
35
34
 
36
35
  RSpec.configure do |config|
37
36
  config.treat_symbols_as_metadata_keys_with_true_values = true
38
- config.mock_framework = :flexmock
37
+ config.mock_framework = :rspec
39
38
  config.filter_run :focus => true
40
39
  config.run_all_when_everything_filtered = true
41
40
  config.color_enabled = true
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module CallControllerTestHelpers
4
- include FlexMock::ArgumentTypes
5
-
6
4
  def self.included(test_case)
7
5
  test_case.let(:call_id) { new_uuid }
8
6
  test_case.let(:call) { Adhearsion::Call.new }
@@ -12,9 +10,7 @@ module CallControllerTestHelpers
12
10
  test_case.subject { controller }
13
11
 
14
12
  test_case.before do
15
- flexmock subject
16
- flexmock controller
17
- flexmock call, :write_command => true, :id => call_id
13
+ call.stub :write_command => true, :id => call_id
18
14
  end
19
15
  end
20
16
 
@@ -28,8 +24,9 @@ module CallControllerTestHelpers
28
24
  end.new call, :doo => :dah, &block
29
25
  end
30
26
 
31
- def expect_message_waiting_for_response(message, fail = false)
32
- expectation = controller.should_receive(:write_and_await_response).once.with message
27
+ def expect_message_waiting_for_response(message = nil, fail = false, &block)
28
+ expectation = controller.should_receive(:write_and_await_response, &block).once
29
+ expectation = expectation.with message if message
33
30
  if fail
34
31
  expectation.and_raise fail
35
32
  else
@@ -38,7 +35,7 @@ module CallControllerTestHelpers
38
35
  end
39
36
 
40
37
  def expect_message_of_type_waiting_for_response(message)
41
- controller.should_receive(:write_and_await_response).once.with(message.class).and_return message
38
+ controller.should_receive(:write_and_await_response).once.with(kind_of(message.class)).and_return message
42
39
  end
43
40
 
44
41
  def expect_component_execution(component, fail = false)
@@ -49,4 +46,10 @@ module CallControllerTestHelpers
49
46
  expectation.and_return component
50
47
  end
51
48
  end
49
+
50
+ def expect_input_component_complete_event(utterance)
51
+ complete_event = Punchblock::Event::Complete.new
52
+ complete_event.stub reason: mock(utterance: utterance, name: :input)
53
+ Punchblock::Component::Input.any_instance.stub(complete?: true, complete_event: complete_event)
54
+ end
52
55
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module InitializerStubs
4
4
  UNWANTED_BEHAVIOR = {
5
- Adhearsion::Initializer => [:debugging_log, :initialize_log_paths, :update_rails_env_var, :require, :init_plugins, :run_plugins, :load_lib_folder]
5
+ Adhearsion::Initializer => [:debugging_log, :initialize_log_paths, :update_rails_env_var, :require, :init_plugins, :run_plugins]
6
6
  } unless defined? UNWANTED_BEHAVIOR
7
7
 
8
8
  def stub_behavior_for_initializer_with_no_path_changing_behavior
@@ -2,7 +2,8 @@
2
2
 
3
3
  def mock_offer(id = nil, headers = {})
4
4
  id ||= rand
5
- flexmock("Offer: #{id}", :call_id => id, :headers_hash => headers).tap do |offer|
6
- offer.should_ignore_missing
5
+ mock("Offer: #{id}").tap do |offer|
6
+ offer.stub :call_id => id, :headers_hash => headers
7
+ offer.as_null_object
7
8
  end
8
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Phillips
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-03-25 00:00:00.000000000 Z
14
+ date: 2013-03-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -279,20 +279,6 @@ dependencies:
279
279
  - - '>='
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
- - !ruby/object:Gem::Dependency
283
- name: flexmock
284
- requirement: !ruby/object:Gem::Requirement
285
- requirements:
286
- - - '>='
287
- - !ruby/object:Gem::Version
288
- version: '0'
289
- type: :development
290
- prerelease: false
291
- version_requirements: !ruby/object:Gem::Requirement
292
- requirements:
293
- - - '>='
294
- - !ruby/object:Gem::Version
295
- version: '0'
296
282
  - !ruby/object:Gem::Dependency
297
283
  name: guard-cucumber
298
284
  requirement: !ruby/object:Gem::Requirement