call_center 0.1.3 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,19 +1,17 @@
1
- source 'http://rubygems.org'
1
+ source :rubygems
2
2
 
3
3
  group :development do
4
- gem 'shoulda', '>= 0'
5
- gem 'bundler', '~> 1.0.0'
4
+ gem 'shoulda'
6
5
  gem 'jeweler', '~> 1.6.4'
7
- gem 'rcov', '>= 0'
8
- gem 'test-unit', :require => 'test/unit'
6
+ gem 'rcov'
9
7
  gem 'guard'
10
8
  gem 'guard-test'
11
- gem 'actionpack', '~> 2.3.10'
9
+ gem 'actionpack', '~> 2.3.14'
12
10
  gem 'mocha'
13
- gem 'bourne'
11
+ gem 'bourne', '>= 1.2.0'
14
12
  gem 'pre-commit'
15
- gem 'minitest', '2.6.1'
16
- gem 'minitest-reporters', :require => 'minitest/reporters'
13
+ gem 'minitest', '~> 3.3.0' # dots disappear at >= 3.4
14
+ gem 'minitest-reporters', :platform => :ruby_19 # https://github.com/busyloop/powerbar/pull/10
17
15
  gem 'guard-shell'
18
16
  end
19
17
 
@@ -1,14 +1,14 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionpack (2.3.12)
5
- activesupport (= 2.3.12)
4
+ actionpack (2.3.14)
5
+ activesupport (= 2.3.14)
6
6
  rack (~> 1.1.0)
7
- activesupport (2.3.12)
8
- ansi (1.3.0)
9
- bourne (1.0)
10
- mocha (= 0.9.8)
11
- builder (3.0.0)
7
+ activesupport (2.3.14)
8
+ ansi (1.4.3)
9
+ bourne (1.2.0)
10
+ mocha (= 0.12.3)
11
+ builder (3.1.3)
12
12
  execjs (1.2.0)
13
13
  multi_json (~> 1.0)
14
14
  git (1.2.5)
@@ -19,26 +19,35 @@ GEM
19
19
  guard-test (0.3.0)
20
20
  guard (>= 0.2.2)
21
21
  test-unit (~> 2.2)
22
+ hashie (1.2.0)
22
23
  hsume2-state_machine (1.0.5)
23
24
  jeweler (1.6.4)
24
25
  bundler (~> 1.0)
25
26
  git (>= 1.2.5)
26
27
  rake
27
- minitest (2.6.1)
28
- minitest-reporters (0.4.0)
28
+ metaclass (0.0.1)
29
+ minitest (3.3.0)
30
+ minitest-reporters (0.11.0)
29
31
  ansi
30
- minitest (~> 2.0)
31
- ruby-progressbar
32
- mocha (0.9.8)
33
- rake
32
+ builder
33
+ minitest (>= 2.12, < 4.0)
34
+ powerbar
35
+ mocha (0.12.3)
36
+ metaclass (~> 0.0.1)
34
37
  multi_json (1.0.3)
38
+ powerbar (1.0.9)
39
+ ansi (~> 1.4.0)
40
+ hashie (>= 1.1.0)
35
41
  pre-commit (0.1.13)
36
42
  execjs
37
- rack (1.1.2)
38
- rake (0.9.2)
43
+ rack (1.1.3)
44
+ rake (0.9.2.2)
39
45
  rcov (0.9.9)
40
- ruby-progressbar (0.0.10)
41
- shoulda (2.11.3)
46
+ shoulda (3.0.1)
47
+ shoulda-context (~> 1.0.0)
48
+ shoulda-matchers (~> 1.0.0)
49
+ shoulda-context (1.0.0)
50
+ shoulda-matchers (1.0.0)
42
51
  test-unit (2.3.0)
43
52
  thor (0.14.6)
44
53
 
@@ -46,19 +55,17 @@ PLATFORMS
46
55
  ruby
47
56
 
48
57
  DEPENDENCIES
49
- actionpack (~> 2.3.10)
50
- bourne
58
+ actionpack (~> 2.3.14)
59
+ bourne (>= 1.2.0)
51
60
  builder
52
- bundler (~> 1.0.0)
53
61
  guard
54
62
  guard-shell
55
63
  guard-test
56
64
  hsume2-state_machine (~> 1.0.5)
57
65
  jeweler (~> 1.6.4)
58
- minitest (= 2.6.1)
66
+ minitest (~> 3.3.0)
59
67
  minitest-reporters
60
68
  mocha
61
69
  pre-commit
62
70
  rcov
63
71
  shoulda
64
- test-unit
File without changes
data/Rakefile CHANGED
@@ -1,15 +1,6 @@
1
1
  # encoding: utf-8
2
-
3
2
  require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
3
+ require 'bundler/setup'
13
4
 
14
5
  require 'jeweler'
15
6
  Jeweler::Tasks.new do |gem|
@@ -27,14 +18,12 @@ Jeweler::RubygemsDotOrgTasks.new
27
18
 
28
19
  require 'rake/testtask'
29
20
  Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
21
  test.pattern = 'test/**/*_test.rb'
32
22
  test.verbose = true
33
23
  end
34
24
 
35
25
  require 'rcov/rcovtask'
36
26
  Rcov::RcovTask.new do |test|
37
- test.libs << 'test'
38
27
  test.pattern = 'test/**/*_test.rb'
39
28
  test.verbose = true
40
29
  test.rcov_opts << '--exclude "gems/*,lib/call_center/core_ext/object_instance_exec.rb"'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.6
@@ -5,15 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "call_center"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henry Hsu"]
12
- s.date = "2012-06-19"
12
+ s.date = "2012-10-10"
13
13
  s.description = "Support for describing call center workflows"
14
14
  s.email = "hhsu@zendesk.com"
15
15
  s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
16
  "README.md"
18
17
  ]
19
18
  s.files = [
@@ -24,7 +23,7 @@ Gem::Specification.new do |s|
24
23
  "Gemfile.lock",
25
24
  "Guardfile",
26
25
  "Guardfile.minitest",
27
- "LICENSE.txt",
26
+ "MIT-LICENSE.txt",
28
27
  "README.md",
29
28
  "Rakefile",
30
29
  "VERSION",
@@ -48,7 +47,6 @@ Gem::Specification.new do |s|
48
47
  "test/examples/legacy_call.rb",
49
48
  "test/examples/multiple_flow_call.rb",
50
49
  "test/examples/non_standard_call.rb",
51
- "test/examples/outbound_call.rb",
52
50
  "test/helper.rb"
53
51
  ]
54
52
  s.homepage = "http://github.com/zendesk/call_center"
@@ -64,34 +62,30 @@ Gem::Specification.new do |s|
64
62
  s.add_runtime_dependency(%q<builder>, [">= 0"])
65
63
  s.add_runtime_dependency(%q<hsume2-state_machine>, ["~> 1.0.5"])
66
64
  s.add_development_dependency(%q<shoulda>, [">= 0"])
67
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
68
65
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
69
66
  s.add_development_dependency(%q<rcov>, [">= 0"])
70
- s.add_development_dependency(%q<test-unit>, [">= 0"])
71
67
  s.add_development_dependency(%q<guard>, [">= 0"])
72
68
  s.add_development_dependency(%q<guard-test>, [">= 0"])
73
- s.add_development_dependency(%q<actionpack>, ["~> 2.3.10"])
69
+ s.add_development_dependency(%q<actionpack>, ["~> 2.3.14"])
74
70
  s.add_development_dependency(%q<mocha>, [">= 0"])
75
71
  s.add_development_dependency(%q<bourne>, [">= 0"])
76
72
  s.add_development_dependency(%q<pre-commit>, [">= 0"])
77
- s.add_development_dependency(%q<minitest>, ["= 2.6.1"])
73
+ s.add_development_dependency(%q<minitest>, ["~> 3.3.0"])
78
74
  s.add_development_dependency(%q<minitest-reporters>, [">= 0"])
79
75
  s.add_development_dependency(%q<guard-shell>, [">= 0"])
80
76
  else
81
77
  s.add_dependency(%q<builder>, [">= 0"])
82
78
  s.add_dependency(%q<hsume2-state_machine>, ["~> 1.0.5"])
83
79
  s.add_dependency(%q<shoulda>, [">= 0"])
84
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
85
80
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
86
81
  s.add_dependency(%q<rcov>, [">= 0"])
87
- s.add_dependency(%q<test-unit>, [">= 0"])
88
82
  s.add_dependency(%q<guard>, [">= 0"])
89
83
  s.add_dependency(%q<guard-test>, [">= 0"])
90
- s.add_dependency(%q<actionpack>, ["~> 2.3.10"])
84
+ s.add_dependency(%q<actionpack>, ["~> 2.3.14"])
91
85
  s.add_dependency(%q<mocha>, [">= 0"])
92
86
  s.add_dependency(%q<bourne>, [">= 0"])
93
87
  s.add_dependency(%q<pre-commit>, [">= 0"])
94
- s.add_dependency(%q<minitest>, ["= 2.6.1"])
88
+ s.add_dependency(%q<minitest>, ["~> 3.3.0"])
95
89
  s.add_dependency(%q<minitest-reporters>, [">= 0"])
96
90
  s.add_dependency(%q<guard-shell>, [">= 0"])
97
91
  end
@@ -99,17 +93,15 @@ Gem::Specification.new do |s|
99
93
  s.add_dependency(%q<builder>, [">= 0"])
100
94
  s.add_dependency(%q<hsume2-state_machine>, ["~> 1.0.5"])
101
95
  s.add_dependency(%q<shoulda>, [">= 0"])
102
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
103
96
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
104
97
  s.add_dependency(%q<rcov>, [">= 0"])
105
- s.add_dependency(%q<test-unit>, [">= 0"])
106
98
  s.add_dependency(%q<guard>, [">= 0"])
107
99
  s.add_dependency(%q<guard-test>, [">= 0"])
108
- s.add_dependency(%q<actionpack>, ["~> 2.3.10"])
100
+ s.add_dependency(%q<actionpack>, ["~> 2.3.14"])
109
101
  s.add_dependency(%q<mocha>, [">= 0"])
110
102
  s.add_dependency(%q<bourne>, [">= 0"])
111
103
  s.add_dependency(%q<pre-commit>, [">= 0"])
112
- s.add_dependency(%q<minitest>, ["= 2.6.1"])
104
+ s.add_dependency(%q<minitest>, ["~> 3.3.0"])
113
105
  s.add_dependency(%q<minitest-reporters>, [">= 0"])
114
106
  s.add_dependency(%q<guard-shell>, [">= 0"])
115
107
  end
@@ -54,10 +54,6 @@ module CallCenter
54
54
  def current_state_machine
55
55
  self.state_machines[self.call_flow_state_machine_name]
56
56
  end
57
-
58
- def inherited(subclass)
59
- subclass.call_flow_state_machine_name ||= self.call_flow_state_machine_name
60
- end
61
57
  end
62
58
 
63
59
  module InstanceMethods
@@ -1,8 +1,21 @@
1
+ require 'action_pack/version'
2
+ if ActionPack::VERSION::MAJOR == 2
3
+ require 'action_controller/assertions/selector_assertions'
4
+ else
5
+ require 'action_dispatch/testing/assertions/selector'
6
+ end
7
+
1
8
  module CallCenter
2
9
  module Test
3
10
  module DSL
4
11
  def self.included(base)
5
- base.send(:include, ActionController::Assertions::SelectorAssertions)
12
+ if ActionPack::VERSION::MAJOR == 2
13
+ base.send(:include, ActionController::Assertions::SelectorAssertions)
14
+ else
15
+ base.send(:include, ActionController::Assertions::SelectorAssertions)
16
+ include ActionDispatch::Assertions::SelectorAssertions
17
+ end
18
+
6
19
  base.extend(ClassMethods)
7
20
  base.class_eval do
8
21
  def response_from_page_or_rjs_with_body
@@ -1,5 +1,10 @@
1
+ require 'action_pack/version'
1
2
  require 'action_controller/vendor/html-scanner'
2
- require 'action_controller/assertions/selector_assertions'
3
+ if ActionPack::VERSION::MAJOR == 2
4
+ require 'action_controller/assertions/selector_assertions'
5
+ else
6
+ require 'action_dispatch/testing/assertions/selector'
7
+ end
3
8
  require 'test/unit/assertions'
4
9
 
5
10
  module CallCenter
@@ -225,7 +230,11 @@ module CallCenter
225
230
 
226
231
  if defined?(::MiniTest::Spec)
227
232
  ::MiniTest::Spec.class_eval do
228
- include ActionController::Assertions::SelectorAssertions
233
+ if ActionPack::VERSION::MAJOR == 2
234
+ include ActionController::Assertions::SelectorAssertions
235
+ else
236
+ include ActionDispatch::Assertions::SelectorAssertions
237
+ end
229
238
 
230
239
  def self.it_should_flow(&block)
231
240
  CallCenter::Test::MiniTest::DSL::ItShouldFlow.new(self, &block).verify
@@ -5,7 +5,6 @@ require File.expand_path('../../../test/examples/call', File.dirname(__FILE__))
5
5
  require File.expand_path('../../../test/examples/dynamic_transition_call', File.dirname(__FILE__))
6
6
 
7
7
  describe CallCenter::Test::MiniTest::DSL do
8
-
9
8
  describe Call do
10
9
  subject { Call.new }
11
10
  let(:call_center_state_field) { :state }
@@ -37,5 +36,4 @@ describe CallCenter::Test::MiniTest::DSL do
37
36
  it_should_flow { on(:picks_up).from(:routing_on_client).to(:in_conference).unless(:out_of_area?) }
38
37
  it_should_flow { on(:picks_up).from(:routing_on_client).to(:cancelled).if(:out_of_area?) }
39
38
  end
40
-
41
39
  end
@@ -1,18 +1,15 @@
1
1
  require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
2
+ require 'bundler/setup'
10
3
  require 'minitest/autorun'
11
4
  require 'mocha'
12
5
  require 'active_support'
13
6
 
7
+ if RUBY_VERSION > "1.9.0"
8
+ require 'minitest/reporters'
9
+ MiniTest::Reporters.use! MiniTest::Reporters::DefaultReporter.new
10
+ end
11
+
14
12
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- $LOAD_PATH.unshift(File.dirname(__FILE__))
16
13
  require 'call_center'
17
14
 
18
15
  module CommonCallMethods
@@ -1,11 +1,9 @@
1
- require 'helper'
1
+ require File.expand_path("../helper", __FILE__)
2
2
 
3
3
  require 'call_center/test/dsl'
4
4
 
5
- require File.expand_path('../test/examples/legacy_call', File.dirname(__FILE__))
6
5
  require File.expand_path('../test/examples/legacy_call', File.dirname(__FILE__))
7
6
  require File.expand_path('../test/examples/call', File.dirname(__FILE__))
8
- require File.expand_path('../test/examples/outbound_call', File.dirname(__FILE__))
9
7
  require File.expand_path('../test/examples/non_standard_call', File.dirname(__FILE__))
10
8
  require File.expand_path('../test/examples/multiple_flow_call', File.dirname(__FILE__))
11
9
  require File.expand_path('../test/examples/dynamic_transition_call', File.dirname(__FILE__))
@@ -177,230 +175,227 @@ class CallCenterTest < Test::Unit::TestCase
177
175
  end
178
176
  end
179
177
 
180
- ['Call', 'SubclassCall'].each do |class_name|
181
- context class_name do
182
- setup do
183
- klass = class_name.constantize
184
- @call = klass.new
185
- end
178
+ context "call" do
179
+ setup do
180
+ @call = Call.new
181
+ end
186
182
 
187
- should "render xml for initial state" do
188
- @call.expects(:notify).with(:rendering_initial)
189
- body @call.render
190
- assert_select "Response>Say", "Hello World"
191
- end
183
+ should "render xml for initial state" do
184
+ @call.expects(:notify).with(:rendering_initial)
185
+ body @call.render
186
+ assert_select "Response>Say", "Hello World"
187
+ end
192
188
 
193
- should "return customer url for event" do
194
- assert_equal("/voice/calls/flow?event=voicemail_complete&actor=customer", @call.customer(:voicemail_complete))
195
- end
189
+ should "return customer url for event" do
190
+ assert_equal("/voice/calls/flow?event=voicemail_complete&actor=customer", @call.customer(:voicemail_complete))
191
+ end
196
192
 
197
- should "return agent url for event" do
198
- assert_equal("/voice/calls/flow?event=voicemail_complete&actor=agent", @call.agent(:voicemail_complete))
199
- end
193
+ should "return agent url for event" do
194
+ assert_equal("/voice/calls/flow?event=voicemail_complete&actor=agent", @call.agent(:voicemail_complete))
195
+ end
200
196
 
201
- should "render xml for voicemail state" do
202
- @call.stubs(:agents_available?).returns(false)
203
- @call.incoming_call!
204
- @call.expects(:notify).with(:rendering_voicemail)
197
+ should "render xml for voicemail state" do
198
+ @call.stubs(:agents_available?).returns(false)
199
+ @call.incoming_call!
200
+ @call.expects(:notify).with(:rendering_voicemail)
205
201
 
206
- body @call.render
207
- assert_select "Response>Say"
208
- assert_select "Response>Record[action=/voice/calls/flow?event=voicemail_complete&actor=customer]"
209
- end
202
+ body @call.render
203
+ assert_select "Response>Say"
204
+ assert_select "Response>Record[action=/voice/calls/flow?event=voicemail_complete&actor=customer]"
205
+ end
210
206
 
211
- should "render noop when no render block" do
212
- @call.stubs(:agents_available?).returns(true)
213
- @call.incoming_call!
207
+ should "render noop when no render block" do
208
+ @call.stubs(:agents_available?).returns(true)
209
+ @call.incoming_call!
214
210
 
215
- body @call.render
216
- assert_select "Response"
217
- end
211
+ body @call.render
212
+ assert_select "Response"
213
+ end
218
214
 
219
- should "execute callbacks" do
220
- @call.state = 'cancelled'
215
+ should "execute callbacks" do
216
+ @call.state = 'cancelled'
221
217
 
222
- @call.expects(:notify).with(:before_always).times(3)
223
- @call.expects(:notify).with(:before_always_uniq).times(1)
218
+ @call.expects(:notify).with(:before_always).times(3)
219
+ @call.expects(:notify).with(:before_always_uniq).times(1)
224
220
 
225
- @call.expects(:notify).with(:after_always).times(4)
226
- @call.expects(:notify).with(:after_success).times(3)
227
- @call.expects(:notify).with(:after_failure).times(1)
221
+ @call.expects(:notify).with(:after_always).times(4)
222
+ @call.expects(:notify).with(:after_success).times(3)
223
+ @call.expects(:notify).with(:after_failure).times(1)
228
224
 
229
- @call.expects(:notify).with(:after_always_uniq).times(1)
230
- @call.expects(:notify).with { |notification, transition| notification == :after_success_uniq && transition.kind_of?(StateMachine::Transition) }.times(1)
231
- @call.expects(:notify).with(:after_failure_uniq).times(0)
225
+ @call.expects(:notify).with(:after_always_uniq).times(1)
226
+ @call.expects(:notify).with { |notification, transition| notification == :after_success_uniq && transition.kind_of?(StateMachine::Transition) }.times(1)
227
+ @call.expects(:notify).with(:after_failure_uniq).times(0)
232
228
 
233
- @call.customer_end!
234
- @call.customer_end!
235
- @call.customer_end!
236
- assert(!@call.customer_hangs_up)
237
- end
229
+ @call.customer_end!
230
+ @call.customer_end!
231
+ @call.customer_end!
232
+ assert(!@call.customer_hangs_up)
233
+ end
238
234
 
239
- should "execute callbacks in sequence" do
240
- seq = sequence('callback_sequence')
241
- @call.state = 'cancelled'
235
+ should "execute callbacks in sequence" do
236
+ seq = sequence('callback_sequence')
237
+ @call.state = 'cancelled'
242
238
 
243
- @call.expects(:notify).with(:before_always).in_sequence(seq)
244
- @call.expects(:notify).with(:before_always_uniq).in_sequence(seq)
239
+ @call.expects(:notify).with(:before_always).in_sequence(seq)
240
+ @call.expects(:notify).with(:before_always_uniq).in_sequence(seq)
245
241
 
246
- @call.expects(:notify).with(:after_always).in_sequence(seq)
247
- @call.expects(:notify).with(:after_success).in_sequence(seq)
242
+ @call.expects(:notify).with(:after_always).in_sequence(seq)
243
+ @call.expects(:notify).with(:after_success).in_sequence(seq)
248
244
 
249
- @call.expects(:notify).with(:after_always_uniq).in_sequence(seq)
250
- @call.expects(:notify).with(:after_success_uniq, anything).in_sequence(seq)
245
+ @call.expects(:notify).with(:after_always_uniq).in_sequence(seq)
246
+ @call.expects(:notify).with(:after_success_uniq, anything).in_sequence(seq)
251
247
 
252
- @call.customer_end!
248
+ @call.customer_end!
249
+ end
250
+
251
+ should "defer callbacks" do
252
+ (class << @call; self; end).class_eval do
253
+ include CallCenter::DeferredCallbacks
253
254
  end
255
+ @call.state = 'cancelled'
254
256
 
255
- should "defer callbacks" do
256
- (class << @call; self; end).class_eval do
257
- include CallCenter::DeferredCallbacks
258
- end
259
- @call.state = 'cancelled'
257
+ @call.expects(:notify).with(:before_always).never
258
+ @call.expects(:notify).with(:before_always_uniq).never
260
259
 
261
- @call.expects(:notify).with(:before_always).never
262
- @call.expects(:notify).with(:before_always_uniq).never
260
+ @call.expects(:notify).with(:after_always).never
261
+ @call.expects(:notify).with(:after_success).never
262
+ @call.expects(:notify).with(:after_failure).never
263
263
 
264
- @call.expects(:notify).with(:after_always).never
265
- @call.expects(:notify).with(:after_success).never
266
- @call.expects(:notify).with(:after_failure).never
264
+ @call.expects(:notify).with(:after_always_uniq).never
265
+ @call.expects(:notify).with(:after_success_uniq, anything).never
267
266
 
268
- @call.expects(:notify).with(:after_always_uniq).never
269
- @call.expects(:notify).with(:after_success_uniq, anything).never
267
+ @call.customer_end!
268
+ assert(!@call.customer_hangs_up)
270
269
 
271
- @call.customer_end!
272
- assert(!@call.customer_hangs_up)
270
+ # Ready for deferred callbacks
273
271
 
274
- # Ready for deferred callbacks
272
+ seq = sequence('callback_sequence')
275
273
 
276
- seq = sequence('callback_sequence')
274
+ @call.expects(:notify).with(:before_always)
275
+ @call.expects(:notify).with(:before_always_uniq)
277
276
 
278
- @call.expects(:notify).with(:before_always)
279
- @call.expects(:notify).with(:before_always_uniq)
277
+ @call.call_flow_run_deferred(:before_transition)
280
278
 
281
- @call.call_flow_run_deferred(:before_transition)
279
+ @call.expects(:notify).with(:after_always).times(2)
280
+ @call.expects(:notify).with(:after_success)
282
281
 
283
- @call.expects(:notify).with(:after_always).times(2)
284
- @call.expects(:notify).with(:after_success)
282
+ @call.expects(:notify).with(:after_always_uniq)
283
+ @call.expects(:notify).with(:after_success_uniq, anything)
285
284
 
286
- @call.expects(:notify).with(:after_always_uniq)
287
- @call.expects(:notify).with(:after_success_uniq, anything)
285
+ @call.call_flow_run_deferred(:after_transition)
288
286
 
289
- @call.call_flow_run_deferred(:after_transition)
287
+ @call.expects(:notify).with(:after_always).times(2)
288
+ @call.expects(:notify).with(:after_failure)
289
+ @call.expects(:notify).with(:after_always_uniq)
290
290
 
291
- @call.expects(:notify).with(:after_always).times(2)
292
- @call.expects(:notify).with(:after_failure)
293
- @call.expects(:notify).with(:after_always_uniq)
291
+ @call.call_flow_run_deferred(:after_failure)
294
292
 
295
- @call.call_flow_run_deferred(:after_failure)
293
+ # Empty
294
+ @call.call_flow_run_deferred(:before_transition)
295
+ @call.call_flow_run_deferred(:after_transition)
296
+ @call.call_flow_run_deferred(:after_failure)
297
+ end
296
298
 
297
- # Empty
298
- @call.call_flow_run_deferred(:before_transition)
299
- @call.call_flow_run_deferred(:after_transition)
300
- @call.call_flow_run_deferred(:after_failure)
301
- end
299
+ should "asynchronously perform event" do
300
+ @call.stubs(:agents_available?).returns(true)
301
+ @call.incoming_call!
302
+ @call.expects(:redirect_to).with(:start_conference)
302
303
 
303
- should "asynchronously perform event" do
304
- @call.stubs(:agents_available?).returns(true)
305
- @call.incoming_call!
306
- @call.expects(:redirect_to).with(:start_conference)
304
+ @call.redirect_and_start_conference!
305
+ end
307
306
 
308
- @call.redirect_and_start_conference!
309
- end
307
+ should "asynchronously perform event with options" do
308
+ @call.stubs(:agents_available?).returns(true)
309
+ @call.incoming_call!
310
+ @call.expects(:redirect_to).with(:start_conference, :status => 'completed')
310
311
 
311
- should "asynchronously perform event with options" do
312
- @call.stubs(:agents_available?).returns(true)
313
- @call.incoming_call!
314
- @call.expects(:redirect_to).with(:start_conference, :status => 'completed')
312
+ @call.redirect_and_start_conference!(:status => 'completed')
313
+ end
315
314
 
316
- @call.redirect_and_start_conference!(:status => 'completed')
317
- end
315
+ should "raise error on missing method" do
316
+ assert_raises {
317
+ @call.i_am_missing!
318
+ }
319
+ end
318
320
 
319
- should "raise error on missing method" do
320
- assert_raises {
321
- @call.i_am_missing!
322
- }
323
- end
321
+ should "draw state machine digraph" do
322
+ Call.state_machines[:state].expects(:draw).with(:name => 'call_workflow', :font => 'Helvetica Neue')
323
+ @call.draw_call_flow(:name => 'call_workflow', :font => 'Helvetica Neue')
324
+ end
324
325
 
325
- should "draw state machine digraph" do
326
- Call.state_machines[:state].expects(:draw).with(:name => 'call_workflow', :font => 'Helvetica Neue')
327
- @call.draw_call_flow(:name => 'call_workflow', :font => 'Helvetica Neue')
326
+ context "using test DSL:" do
327
+ should_flow :on => :incoming_call, :initial => :voicemail, :when => Proc.new {
328
+ @call.stubs(:agents_available?).returns(false)
329
+ @call.stubs(:notify)
330
+ @call.stubs(:customer).returns('the_flow')
331
+ } do
332
+ should_also { assert_received(@call, :notify) { |e| e.with(:rendering_voicemail) } }
333
+ and_also { assert_received(@call, :customer) { |e| e.with(:voicemail_complete) } }
334
+ and_render { "Response>Say" }
335
+ and_render { "Response>Record[action=the_flow]" }
328
336
  end
329
337
 
330
- context "using test DSL:" do
331
- should_flow :on => :incoming_call, :initial => :voicemail, :when => Proc.new {
332
- @call.stubs(:agents_available?).returns(false)
333
- @call.stubs(:notify)
334
- @call.stubs(:customer).returns('the_flow')
335
- } do
336
- should_also { assert_received(@call, :notify) { |e| e.with(:rendering_voicemail) } }
337
- and_also { assert_received(@call, :customer) { |e| e.with(:voicemail_complete) } }
338
- and_render { "Response>Say" }
339
- and_render { "Response>Record[action=the_flow]" }
340
- end
338
+ should_flow :on => :incoming_call, :initial => :routing, :when => Proc.new {
339
+ @call.stubs(:agents_available?).returns(true)
340
+ } do
341
+ should_render { "Response" }
342
+ end
341
343
 
342
- should_flow :on => :incoming_call, :initial => :routing, :when => Proc.new {
343
- @call.stubs(:agents_available?).returns(true)
344
- } do
345
- should_render { "Response" }
346
- end
344
+ should_flow :on => :customer_hangs_up, :routing => :cancelled, :when => Proc.new {
345
+ @call.stubs(:notify)
346
+ } do
347
+ should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } }
348
+ and_also { assert @call.cancelled? }
347
349
 
348
- should_flow :on => :customer_hangs_up, :routing => :cancelled, :when => Proc.new {
349
- @call.stubs(:notify)
350
- } do
351
- should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } }
350
+ should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
351
+ should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
352
352
  and_also { assert @call.cancelled? }
353
353
 
354
354
  should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
355
355
  should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
356
356
  and_also { assert @call.cancelled? }
357
-
358
- should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
359
- should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
360
- and_also { assert @call.cancelled? }
361
- end
362
357
  end
363
358
  end
364
359
  end
360
+ end
365
361
 
366
- context "deferred and using test DSL:" do
367
- setup do
368
- (class << @call; self; end).class_eval do
369
- include CallCenter::DeferredCallbacks
370
- end
362
+ context "deferred and using test DSL:" do
363
+ setup do
364
+ (class << @call; self; end).class_eval do
365
+ include CallCenter::DeferredCallbacks
371
366
  end
367
+ end
372
368
 
373
- should_flow :on => :incoming_call, :initial => :voicemail, :when => Proc.new {
374
- @call.stubs(:agents_available?).returns(false)
375
- @call.stubs(:notify)
376
- @call.stubs(:customer).returns('the_flow')
377
- } do
378
- should_also { assert_received(@call, :notify) { |e| e.with(:rendering_voicemail) } }
379
- and_also { assert_received(@call, :customer) { |e| e.with(:voicemail_complete) } }
380
- and_render { "Response>Say" }
381
- and_render { "Response>Record[action=the_flow]" }
382
- end
369
+ should_flow :on => :incoming_call, :initial => :voicemail, :when => Proc.new {
370
+ @call.stubs(:agents_available?).returns(false)
371
+ @call.stubs(:notify)
372
+ @call.stubs(:customer).returns('the_flow')
373
+ } do
374
+ should_also { assert_received(@call, :notify) { |e| e.with(:rendering_voicemail) } }
375
+ and_also { assert_received(@call, :customer) { |e| e.with(:voicemail_complete) } }
376
+ and_render { "Response>Say" }
377
+ and_render { "Response>Record[action=the_flow]" }
378
+ end
383
379
 
384
- should_flow :on => :incoming_call, :initial => :routing, :when => Proc.new {
385
- @call.stubs(:agents_available?).returns(true)
386
- } do
387
- should_render { "Response" }
388
- end
380
+ should_flow :on => :incoming_call, :initial => :routing, :when => Proc.new {
381
+ @call.stubs(:agents_available?).returns(true)
382
+ } do
383
+ should_render { "Response" }
384
+ end
389
385
 
390
- should_flow :on => :customer_hangs_up, :routing => :cancelled, :when => Proc.new {
391
- @call.stubs(:notify)
392
- } do
393
- should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } }
386
+ should_flow :on => :customer_hangs_up, :routing => :cancelled, :when => Proc.new {
387
+ @call.stubs(:notify)
388
+ } do
389
+ should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } }
390
+ and_also { assert @call.cancelled? }
391
+
392
+ should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
393
+ should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
394
394
  and_also { assert @call.cancelled? }
395
395
 
396
396
  should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
397
397
  should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
398
398
  and_also { assert @call.cancelled? }
399
-
400
- should_flow :on => :customer_hangs_up, :cancelled => :cancelled do
401
- should_also { assert_received(@call, :notify) { |e| e.with(:cancelled).once } } # For above
402
- and_also { assert @call.cancelled? }
403
- end
404
399
  end
405
400
  end
406
401
  end
@@ -1,7 +1,6 @@
1
- require 'helper'
1
+ require File.expand_path("../helper", __FILE__)
2
2
 
3
3
  class MyObject
4
-
5
4
  end
6
5
 
7
6
  class CoreExtTest < Test::Unit::TestCase
@@ -1,24 +1,16 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
1
+ require 'bundler/setup'
10
2
  require 'test/unit'
11
3
  require 'shoulda'
12
4
  require 'mocha'
13
5
  require 'bourne'
14
6
 
15
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
16
- $LOAD_PATH.unshift(File.dirname(__FILE__))
17
8
  require 'call_center'
18
9
 
19
10
  require 'active_support'
20
11
  require 'action_pack'
21
12
  require 'action_controller'
13
+
22
14
  class Test::Unit::TestCase
23
15
  def response_from_page_or_rjs
24
16
  HTML::Document.new(@body).root
@@ -35,4 +27,4 @@ module CommonCallMethods
35
27
  def voicemail; end
36
28
  def voicemail_completed; end
37
29
  def routing; end
38
- end
30
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: call_center
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henry Hsu
@@ -15,12 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-19 00:00:00 Z
18
+ date: 2012-10-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
23
  none: false
25
24
  requirements:
26
25
  - - ">="
@@ -30,11 +29,11 @@ dependencies:
30
29
  - 0
31
30
  version: "0"
32
31
  type: :runtime
33
- version_requirements: *id001
32
+ requirement: *id001
33
+ prerelease: false
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: hsume2-state_machine
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
37
  none: false
39
38
  requirements:
40
39
  - - ~>
@@ -46,11 +45,11 @@ dependencies:
46
45
  - 5
47
46
  version: 1.0.5
48
47
  type: :runtime
49
- version_requirements: *id002
48
+ requirement: *id002
49
+ prerelease: false
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: shoulda
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
52
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
53
  none: false
55
54
  requirements:
56
55
  - - ">="
@@ -60,27 +59,11 @@ dependencies:
60
59
  - 0
61
60
  version: "0"
62
61
  type: :development
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: bundler
62
+ requirement: *id003
66
63
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 23
73
- segments:
74
- - 1
75
- - 0
76
- - 0
77
- version: 1.0.0
78
- type: :development
79
- version_requirements: *id004
80
64
  - !ruby/object:Gem::Dependency
81
65
  name: jeweler
82
- prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
66
+ version_requirements: &id004 !ruby/object:Gem::Requirement
84
67
  none: false
85
68
  requirements:
86
69
  - - ~>
@@ -92,11 +75,11 @@ dependencies:
92
75
  - 4
93
76
  version: 1.6.4
94
77
  type: :development
95
- version_requirements: *id005
78
+ requirement: *id004
79
+ prerelease: false
96
80
  - !ruby/object:Gem::Dependency
97
81
  name: rcov
98
- prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
82
+ version_requirements: &id005 !ruby/object:Gem::Requirement
100
83
  none: false
101
84
  requirements:
102
85
  - - ">="
@@ -106,25 +89,11 @@ dependencies:
106
89
  - 0
107
90
  version: "0"
108
91
  type: :development
109
- version_requirements: *id006
110
- - !ruby/object:Gem::Dependency
111
- name: test-unit
92
+ requirement: *id005
112
93
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
- version: "0"
122
- type: :development
123
- version_requirements: *id007
124
94
  - !ruby/object:Gem::Dependency
125
95
  name: guard
126
- prerelease: false
127
- requirement: &id008 !ruby/object:Gem::Requirement
96
+ version_requirements: &id006 !ruby/object:Gem::Requirement
128
97
  none: false
129
98
  requirements:
130
99
  - - ">="
@@ -134,11 +103,11 @@ dependencies:
134
103
  - 0
135
104
  version: "0"
136
105
  type: :development
137
- version_requirements: *id008
106
+ requirement: *id006
107
+ prerelease: false
138
108
  - !ruby/object:Gem::Dependency
139
109
  name: guard-test
140
- prerelease: false
141
- requirement: &id009 !ruby/object:Gem::Requirement
110
+ version_requirements: &id007 !ruby/object:Gem::Requirement
142
111
  none: false
143
112
  requirements:
144
113
  - - ">="
@@ -148,27 +117,27 @@ dependencies:
148
117
  - 0
149
118
  version: "0"
150
119
  type: :development
151
- version_requirements: *id009
120
+ requirement: *id007
121
+ prerelease: false
152
122
  - !ruby/object:Gem::Dependency
153
123
  name: actionpack
154
- prerelease: false
155
- requirement: &id010 !ruby/object:Gem::Requirement
124
+ version_requirements: &id008 !ruby/object:Gem::Requirement
156
125
  none: false
157
126
  requirements:
158
127
  - - ~>
159
128
  - !ruby/object:Gem::Version
160
- hash: 23
129
+ hash: 31
161
130
  segments:
162
131
  - 2
163
132
  - 3
164
- - 10
165
- version: 2.3.10
133
+ - 14
134
+ version: 2.3.14
166
135
  type: :development
167
- version_requirements: *id010
136
+ requirement: *id008
137
+ prerelease: false
168
138
  - !ruby/object:Gem::Dependency
169
139
  name: mocha
170
- prerelease: false
171
- requirement: &id011 !ruby/object:Gem::Requirement
140
+ version_requirements: &id009 !ruby/object:Gem::Requirement
172
141
  none: false
173
142
  requirements:
174
143
  - - ">="
@@ -178,25 +147,27 @@ dependencies:
178
147
  - 0
179
148
  version: "0"
180
149
  type: :development
181
- version_requirements: *id011
150
+ requirement: *id009
151
+ prerelease: false
182
152
  - !ruby/object:Gem::Dependency
183
153
  name: bourne
184
- prerelease: false
185
- requirement: &id012 !ruby/object:Gem::Requirement
154
+ version_requirements: &id010 !ruby/object:Gem::Requirement
186
155
  none: false
187
156
  requirements:
188
157
  - - ">="
189
158
  - !ruby/object:Gem::Version
190
- hash: 3
159
+ hash: 31
191
160
  segments:
161
+ - 1
162
+ - 2
192
163
  - 0
193
- version: "0"
164
+ version: 1.2.0
194
165
  type: :development
195
- version_requirements: *id012
166
+ requirement: *id010
167
+ prerelease: false
196
168
  - !ruby/object:Gem::Dependency
197
169
  name: pre-commit
198
- prerelease: false
199
- requirement: &id013 !ruby/object:Gem::Requirement
170
+ version_requirements: &id011 !ruby/object:Gem::Requirement
200
171
  none: false
201
172
  requirements:
202
173
  - - ">="
@@ -206,27 +177,27 @@ dependencies:
206
177
  - 0
207
178
  version: "0"
208
179
  type: :development
209
- version_requirements: *id013
180
+ requirement: *id011
181
+ prerelease: false
210
182
  - !ruby/object:Gem::Dependency
211
183
  name: minitest
212
- prerelease: false
213
- requirement: &id014 !ruby/object:Gem::Requirement
184
+ version_requirements: &id012 !ruby/object:Gem::Requirement
214
185
  none: false
215
186
  requirements:
216
- - - "="
187
+ - - ~>
217
188
  - !ruby/object:Gem::Version
218
- hash: 21
189
+ hash: 11
219
190
  segments:
220
- - 2
221
- - 6
222
- - 1
223
- version: 2.6.1
191
+ - 3
192
+ - 3
193
+ - 0
194
+ version: 3.3.0
224
195
  type: :development
225
- version_requirements: *id014
196
+ requirement: *id012
197
+ prerelease: false
226
198
  - !ruby/object:Gem::Dependency
227
199
  name: minitest-reporters
228
- prerelease: false
229
- requirement: &id015 !ruby/object:Gem::Requirement
200
+ version_requirements: &id013 !ruby/object:Gem::Requirement
230
201
  none: false
231
202
  requirements:
232
203
  - - ">="
@@ -236,11 +207,11 @@ dependencies:
236
207
  - 0
237
208
  version: "0"
238
209
  type: :development
239
- version_requirements: *id015
210
+ requirement: *id013
211
+ prerelease: false
240
212
  - !ruby/object:Gem::Dependency
241
213
  name: guard-shell
242
- prerelease: false
243
- requirement: &id016 !ruby/object:Gem::Requirement
214
+ version_requirements: &id014 !ruby/object:Gem::Requirement
244
215
  none: false
245
216
  requirements:
246
217
  - - ">="
@@ -250,7 +221,8 @@ dependencies:
250
221
  - 0
251
222
  version: "0"
252
223
  type: :development
253
- version_requirements: *id016
224
+ requirement: *id014
225
+ prerelease: false
254
226
  description: Support for describing call center workflows
255
227
  email: hhsu@zendesk.com
256
228
  executables: []
@@ -258,7 +230,6 @@ executables: []
258
230
  extensions: []
259
231
 
260
232
  extra_rdoc_files:
261
- - LICENSE.txt
262
233
  - README.md
263
234
  files:
264
235
  - .document
@@ -268,7 +239,7 @@ files:
268
239
  - Gemfile.lock
269
240
  - Guardfile
270
241
  - Guardfile.minitest
271
- - LICENSE.txt
242
+ - MIT-LICENSE.txt
272
243
  - README.md
273
244
  - Rakefile
274
245
  - VERSION
@@ -292,7 +263,6 @@ files:
292
263
  - test/examples/legacy_call.rb
293
264
  - test/examples/multiple_flow_call.rb
294
265
  - test/examples/non_standard_call.rb
295
- - test/examples/outbound_call.rb
296
266
  - test/helper.rb
297
267
  homepage: http://github.com/zendesk/call_center
298
268
  licenses:
@@ -1,3 +0,0 @@
1
- class SubclassCall < Call
2
-
3
- end