call_center 0.1.2 → 0.1.3

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.
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - ree
4
+ - 1.9.2
5
+ - 1.9.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/call_center.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{call_center}
8
- s.version = "0.1.2"
7
+ s.name = "call_center"
8
+ s.version = "0.1.3"
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 = %q{2012-06-04}
13
- s.description = %q{Support for describing call center workflows}
14
- s.email = %q{hhsu@zendesk.com}
12
+ s.date = "2012-06-19"
13
+ s.description = "Support for describing call center workflows"
14
+ s.email = "hhsu@zendesk.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.md"
@@ -48,13 +48,14 @@ Gem::Specification.new do |s|
48
48
  "test/examples/legacy_call.rb",
49
49
  "test/examples/multiple_flow_call.rb",
50
50
  "test/examples/non_standard_call.rb",
51
+ "test/examples/outbound_call.rb",
51
52
  "test/helper.rb"
52
53
  ]
53
- s.homepage = %q{http://github.com/zendesk/call_center}
54
+ s.homepage = "http://github.com/zendesk/call_center"
54
55
  s.licenses = ["MIT"]
55
56
  s.require_paths = ["lib"]
56
- s.rubygems_version = %q{1.5.3}
57
- s.summary = %q{Support for describing call center workflows}
57
+ s.rubygems_version = "1.8.24"
58
+ s.summary = "Support for describing call center workflows"
58
59
 
59
60
  if s.respond_to? :specification_version then
60
61
  s.specification_version = 3
@@ -134,8 +134,7 @@ module CallCenter
134
134
  end
135
135
  state_field = defined?(call_center_state_field) ? call_center_state_field.to_sym : :state
136
136
  subject.send(:"#{state_field}=", from)
137
- subject.send(:"#{event}!")
138
- subject.send(state_field).must_equal(to)
137
+ helper.verify_send(subject, event, state_field, to)
139
138
  if subject.respond_to?(:call_flow_run_deferred)
140
139
  subject.call_flow_run_deferred(:before_transition)
141
140
  subject.call_flow_run_deferred(:after_transition)
@@ -144,6 +143,15 @@ module CallCenter
144
143
  end
145
144
  end
146
145
 
146
+ def send_event(subject, event)
147
+ subject.send(:"#{event}!")
148
+ end
149
+
150
+ def verify_send(subject, event, state_field, to)
151
+ send_event(subject, event)
152
+ subject.send(state_field).must_equal(to)
153
+ end
154
+
147
155
  private
148
156
 
149
157
  def description
@@ -151,6 +159,22 @@ module CallCenter
151
159
  end
152
160
  end
153
161
 
162
+ class ItShouldNotFlow < ItShouldFlow
163
+ def send_event(subject, event)
164
+ subject.send(:"#{event}")
165
+ end
166
+
167
+ def verify_send(subject, event, state_field, to)
168
+ send_event(subject, event).wont_equal(true)
169
+ end
170
+
171
+ private
172
+
173
+ def description
174
+ "should not flow on ##{@event}! from :#{@from}"
175
+ end
176
+ end
177
+
154
178
  class ItShouldRender < ItShouldFlow
155
179
  def is(state)
156
180
  @state = state
@@ -207,6 +231,10 @@ module CallCenter
207
231
  CallCenter::Test::MiniTest::DSL::ItShouldFlow.new(self, &block).verify
208
232
  end
209
233
 
234
+ def self.it_should_not_flow(&block)
235
+ CallCenter::Test::MiniTest::DSL::ItShouldNotFlow.new(self, &block).verify
236
+ end
237
+
210
238
  def self.it_should_render(&block)
211
239
  CallCenter::Test::MiniTest::DSL::ItShouldRender.new(self, &block).verify
212
240
  end
@@ -1,8 +1,8 @@
1
- require 'minitest/helper'
1
+ require File.expand_path('../../helper', File.dirname(__FILE__))
2
2
  require 'call_center/test/minitest/dsl'
3
3
 
4
- require 'test/examples/call'
5
- require 'test/examples/dynamic_transition_call'
4
+ require File.expand_path('../../../test/examples/call', File.dirname(__FILE__))
5
+ require File.expand_path('../../../test/examples/dynamic_transition_call', File.dirname(__FILE__))
6
6
 
7
7
  describe CallCenter::Test::MiniTest::DSL do
8
8
 
@@ -20,6 +20,8 @@ describe CallCenter::Test::MiniTest::DSL do
20
20
  it_should_flow { on(:something_crazy_happens).from(:initial).to(:uh_oh) }
21
21
 
22
22
  it_should_flow { on(:customer_hangs_up).from(:cancelled).to(:cancelled).expects(:cancelled) { |e| e.never } }
23
+
24
+ it_should_not_flow { on(:incoming_call).from(:voicemail) }
23
25
  end
24
26
 
25
27
  describe DynamicTransitionCall do
@@ -2,12 +2,13 @@ require 'helper'
2
2
 
3
3
  require 'call_center/test/dsl'
4
4
 
5
- require 'test/examples/legacy_call'
6
- require 'test/examples/call'
7
- require 'test/examples/outbound_call'
8
- require 'test/examples/non_standard_call'
9
- require 'test/examples/multiple_flow_call'
10
- require 'test/examples/dynamic_transition_call'
5
+ require File.expand_path('../test/examples/legacy_call', File.dirname(__FILE__))
6
+ require File.expand_path('../test/examples/legacy_call', File.dirname(__FILE__))
7
+ require File.expand_path('../test/examples/call', File.dirname(__FILE__))
8
+ require File.expand_path('../test/examples/outbound_call', File.dirname(__FILE__))
9
+ require File.expand_path('../test/examples/non_standard_call', File.dirname(__FILE__))
10
+ require File.expand_path('../test/examples/multiple_flow_call', File.dirname(__FILE__))
11
+ require File.expand_path('../test/examples/dynamic_transition_call', File.dirname(__FILE__))
11
12
 
12
13
  class CallCenterTest < Test::Unit::TestCase
13
14
  include CallCenter::Test::DSL
@@ -0,0 +1,3 @@
1
+ class SubclassCall < Call
2
+
3
+ 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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henry Hsu
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-04 00:00:00 -07:00
19
- default_executable:
18
+ date: 2012-06-19 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: builder
@@ -293,8 +292,8 @@ files:
293
292
  - test/examples/legacy_call.rb
294
293
  - test/examples/multiple_flow_call.rb
295
294
  - test/examples/non_standard_call.rb
295
+ - test/examples/outbound_call.rb
296
296
  - test/helper.rb
297
- has_rdoc: true
298
297
  homepage: http://github.com/zendesk/call_center
299
298
  licenses:
300
299
  - MIT
@@ -324,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
323
  requirements: []
325
324
 
326
325
  rubyforge_project:
327
- rubygems_version: 1.5.3
326
+ rubygems_version: 1.8.24
328
327
  signing_key:
329
328
  specification_version: 3
330
329
  summary: Support for describing call center workflows