twilio-test-toolkit 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,6 +84,11 @@ module TwilioTestToolkit
84
84
  return @xml["method"]
85
85
  end
86
86
 
87
+ def gather_finish_on_key
88
+ raise "Not a gather" unless gather?
89
+ return @xml["finishOnKey"] || '#' # '#' is the default finish key if not specified
90
+ end
91
+
87
92
  def press(digits)
88
93
  raise "Not a gather" unless gather?
89
94
 
@@ -91,7 +96,7 @@ module TwilioTestToolkit
91
96
  path = gather_action
92
97
 
93
98
  # Update the root call
94
- root_call.request_for_twiml!(path, :digits => digits, :method => gather_method)
99
+ root_call.request_for_twiml!(path, :digits => digits, :method => gather_method, :finish_on_key => gather_finish_on_key)
95
100
  end
96
101
 
97
102
  # Some basic accessors
@@ -116,6 +121,16 @@ module TwilioTestToolkit
116
121
  @xml.at_xpath("Gather")
117
122
  end
118
123
 
124
+ def formatted_digits(digits, options = {})
125
+ if digits.nil?
126
+ ''
127
+ elsif options[:finish_on_key]
128
+ digits.to_s.split(options[:finish_on_key])[0]
129
+ else
130
+ digits
131
+ end
132
+ end
133
+
119
134
  protected
120
135
  # New object creation
121
136
  def self.from_xml(parent, xml)
@@ -159,7 +174,7 @@ module TwilioTestToolkit
159
174
  :format => :xml,
160
175
  :CallSid => @root_call.sid,
161
176
  :From => @root_call.from_number,
162
- :Digits => options[:digits] || "",
177
+ :Digits => formatted_digits(options[:digits], :finish_on_key => options[:finish_on_key]),
163
178
  :To => @root_call.to_number,
164
179
  :AnsweredBy => (options[:is_machine] ? "machine" : "human")
165
180
  )
@@ -1,3 +1,3 @@
1
1
  module TwilioTestToolkit
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -1,2 +1,2 @@
1
- <Say voice="woman">You entered <%= @digits %></Say>
1
+ <Say voice="woman">You entered <%= @digits %>.</Say>
2
2
  <Redirect><%= twilio_index_path %></Redirect>
@@ -0,0 +1,3 @@
1
+ <Gather finishOnKey="*" action="<%= test_action_twilio_index_path %>" method="post">
2
+ <Say>Please enter some digits followed by hash.</Say>
3
+ </Gather>
@@ -4,6 +4,7 @@ Dummy::Application.routes.draw do
4
4
  post "test_start", :on => :collection
5
5
  post "test_action", :on => :collection
6
6
 
7
+ post "test_gather_finish_on_asterisk", :on => :collection
7
8
  post "test_hangup", :on => :collection
8
9
  post "test_dial", :on => :collection
9
10
  post "test_redirect", :on => :collection
@@ -1544,3 +1544,201 @@ Started GET "/twilio/test_start?format=xml&CallSid=1234567&From=2065551212&Digit
1544
1544
  Processing by TwilioController#test_start as XML
1545
1545
  Parameters: {"CallSid"=>"1234567", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"machine"}
1546
1546
  Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
1547
+ Connecting to database specified by database.yml
1548
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1549
+ Processing by TwilioController#test_start as XML
1550
+ Parameters: {"CallSid"=>"95b9dd43-f2db-45df-9fd9-7b259433fc56", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1551
+ Rendered twilio/test_start.xml.erb within layouts/twilio.layout (3.2ms)
1552
+ Completed 200 OK in 13ms (Views: 13.0ms | ActiveRecord: 0.0ms)
1553
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1554
+ Processing by TwilioController#test_start as XML
1555
+ Parameters: {"CallSid"=>"96478b69-e958-48e9-8435-b429aa9228a8", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1556
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1557
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1558
+ Processing by TwilioController#test_start as XML
1559
+ Parameters: {"CallSid"=>"ddf76158-2e62-4b01-a76c-a16629fc1869", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1560
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1561
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1562
+ Processing by TwilioController#test_start as XML
1563
+ Parameters: {"CallSid"=>"6393a6c8-1c40-48e1-8811-b1b250e85a1a", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1564
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1565
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1566
+ Processing by TwilioController#test_start as XML
1567
+ Parameters: {"CallSid"=>"40e8af61-0978-4013-8ddb-86acc2ba62b5", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1568
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1569
+ Started POST "/twilio/test_redirect" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1570
+ Processing by TwilioController#test_redirect as XML
1571
+ Parameters: {"CallSid"=>"44bc3e1c-adbf-41a7-9f9c-87e4772d71cc", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1572
+ Completed 200 OK in 1ms (Views: 1.1ms | ActiveRecord: 0.0ms)
1573
+ Started POST "/twilio/test_redirect" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1574
+ Processing by TwilioController#test_redirect as XML
1575
+ Parameters: {"CallSid"=>"05445e6f-c8b0-45bc-8a95-7694b6a16f75", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1576
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1577
+ Started POST "/twilio/test_redirect" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1578
+ Processing by TwilioController#test_redirect as XML
1579
+ Parameters: {"CallSid"=>"c95dccc0-ae73-43df-bdad-fa0913380197", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1580
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1581
+ Started POST "/twilio/test_redirect" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1582
+ Processing by TwilioController#test_redirect as XML
1583
+ Parameters: {"CallSid"=>"d35bfcdc-d0d2-4585-bf8e-c7b8ddae2ab6", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1584
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1585
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1586
+ Processing by TwilioController#test_start as XML
1587
+ Parameters: {"CallSid"=>"d35bfcdc-d0d2-4585-bf8e-c7b8ddae2ab6", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1588
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1589
+ Started POST "/twilio/test_redirect" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1590
+ Processing by TwilioController#test_redirect as XML
1591
+ Parameters: {"CallSid"=>"cb1dca3b-e350-48a4-b482-f96f304cb988", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1592
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1593
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1594
+ Processing by TwilioController#test_start as XML
1595
+ Parameters: {"CallSid"=>"cb1dca3b-e350-48a4-b482-f96f304cb988", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1596
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1597
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1598
+ Processing by TwilioController#test_say as XML
1599
+ Parameters: {"CallSid"=>"7fb6b025-74e3-4733-b84f-da62c104b143", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1600
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
1601
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1602
+ Processing by TwilioController#test_say as XML
1603
+ Parameters: {"CallSid"=>"c69268ab-e9fd-48cc-9cee-83c48919e21c", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1604
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1605
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1606
+ Processing by TwilioController#test_say as XML
1607
+ Parameters: {"CallSid"=>"58146027-322e-421c-bc3d-9308170e8f76", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1608
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1609
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1610
+ Processing by TwilioController#test_say as XML
1611
+ Parameters: {"CallSid"=>"0fc60dac-5dfd-4ffb-b24d-050e68d16b10", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1612
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1613
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1614
+ Processing by TwilioController#test_say as XML
1615
+ Parameters: {"CallSid"=>"a6715053-2ca5-48be-bec5-b58589c6784b", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1616
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1617
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1618
+ Processing by TwilioController#test_say as XML
1619
+ Parameters: {"CallSid"=>"c9e1157b-6d02-4033-8124-345327199f53", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1620
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1621
+ Started POST "/twilio/test_play" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1622
+ Processing by TwilioController#test_play as XML
1623
+ Parameters: {"CallSid"=>"83dbdcaf-5e6d-415c-aa6b-7a5692a0c8f4", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1624
+ Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
1625
+ Started POST "/twilio/test_play" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1626
+ Processing by TwilioController#test_play as XML
1627
+ Parameters: {"CallSid"=>"4d18e4c9-2ff3-4889-8fd9-4af409836ee0", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1628
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1629
+ Started POST "/twilio/test_dial" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1630
+ Processing by TwilioController#test_dial as XML
1631
+ Parameters: {"CallSid"=>"5b59f2c6-14e8-442b-980e-8ab47bc510a3", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1632
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
1633
+ Started POST "/twilio/test_dial" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1634
+ Processing by TwilioController#test_dial as XML
1635
+ Parameters: {"CallSid"=>"d2c04003-e672-460f-95de-897fd5a0d655", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1636
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1637
+ Started POST "/twilio/test_hangup" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1638
+ Processing by TwilioController#test_hangup as XML
1639
+ Parameters: {"CallSid"=>"b09a5dd8-bbc8-4596-a72a-04583b7daf35", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1640
+ Completed 200 OK in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)
1641
+ Started POST "/twilio/test_hangup" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1642
+ Processing by TwilioController#test_hangup as XML
1643
+ Parameters: {"CallSid"=>"a66a2bf7-9b6e-4e75-b4d0-9add52171822", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1644
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1645
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1646
+ Processing by TwilioController#test_start as XML
1647
+ Parameters: {"CallSid"=>"64d1b1fd-4f06-4a34-861d-f9997cacaf16", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1648
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1649
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1650
+ Processing by TwilioController#test_start as XML
1651
+ Parameters: {"CallSid"=>"36c8ab40-d7f2-4a0f-8fa9-197a87d75207", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1652
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1653
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1654
+ Processing by TwilioController#test_start as XML
1655
+ Parameters: {"CallSid"=>"9f52acb0-f183-4b21-877e-5bbc42c85db8", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1656
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1657
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1658
+ Processing by TwilioController#test_start as XML
1659
+ Parameters: {"CallSid"=>"1cc2189f-fca4-405a-ad1a-3f399c036dd0", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1660
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1661
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1662
+ Processing by TwilioController#test_start as XML
1663
+ Parameters: {"CallSid"=>"f975b419-2309-41a4-8434-7130434cdc8b", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1664
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1665
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1666
+ Processing by TwilioController#test_start as XML
1667
+ Parameters: {"CallSid"=>"c8730385-e38a-4b1d-8db6-904af914cd41", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1668
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1669
+ Started POST "/twilio/test_action" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1670
+ Processing by TwilioController#test_action as XML
1671
+ Parameters: {"CallSid"=>"c8730385-e38a-4b1d-8db6-904af914cd41", "From"=>"2065551212", "Digits"=>"98765", "To"=>"2065553434", "AnsweredBy"=>"human"}
1672
+ Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)
1673
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1674
+ Processing by TwilioController#test_start as XML
1675
+ Parameters: {"CallSid"=>"06613d21-7c0f-4c48-a8d5-a815f04f2dd4", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1676
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1677
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1678
+ Processing by TwilioController#test_start as XML
1679
+ Parameters: {"CallSid"=>"083c64fc-cd38-44d0-8717-9c3a47d46728", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1680
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1681
+ Started POST "/twilio/test_action" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1682
+ Processing by TwilioController#test_action as XML
1683
+ Parameters: {"CallSid"=>"083c64fc-cd38-44d0-8717-9c3a47d46728", "From"=>"2065551212", "Digits"=>"98765", "To"=>"2065553434", "AnsweredBy"=>"human"}
1684
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1685
+ Started POST "/twilio/test_gather_finish_on_asterisk" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1686
+ Processing by TwilioController#test_gather_finish_on_asterisk as XML
1687
+ Parameters: {"CallSid"=>"ba41cbe4-4859-47ef-bffa-aca3858cdb25", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1688
+ Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)
1689
+ Started POST "/twilio/test_action" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1690
+ Processing by TwilioController#test_action as XML
1691
+ Parameters: {"CallSid"=>"ba41cbe4-4859-47ef-bffa-aca3858cdb25", "From"=>"2065551212", "Digits"=>"98765", "To"=>"2065553434", "AnsweredBy"=>"human"}
1692
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
1693
+ Started POST "/twilio/test_gather_finish_on_asterisk" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1694
+ Processing by TwilioController#test_gather_finish_on_asterisk as XML
1695
+ Parameters: {"CallSid"=>"fb966440-34d1-452a-a2e3-e4c150941fc6", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1696
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1697
+ Started POST "/twilio/test_action" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1698
+ Processing by TwilioController#test_action as XML
1699
+ Parameters: {"CallSid"=>"fb966440-34d1-452a-a2e3-e4c150941fc6", "From"=>"2065551212", "Digits"=>"98765", "To"=>"2065553434", "AnsweredBy"=>"human"}
1700
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1701
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1702
+ Processing by TwilioController#test_say as XML
1703
+ Parameters: {"CallSid"=>"3c6f4bd6-1c23-490b-b355-8000f495e695", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1704
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1705
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1706
+ Processing by TwilioController#test_say as XML
1707
+ Parameters: {"CallSid"=>"205fa000-6b78-48ac-b909-ef2ff1aa0b58", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1708
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1709
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1710
+ Processing by TwilioController#test_say as XML
1711
+ Parameters: {"CallSid"=>"586a483d-8161-4794-9fee-d87bacf5d7f6", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1712
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1713
+ Started POST "/twilio/test_say" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1714
+ Processing by TwilioController#test_say as XML
1715
+ Parameters: {"CallSid"=>"3cb2ddf6-0a2e-49da-be72-1417304a54b1", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1716
+ Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1717
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1718
+ Processing by TwilioController#test_start as XML
1719
+ Parameters: {"CallSid"=>"5fc26d3a-edbe-4698-9354-406229c5efd9", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1720
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1721
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1722
+ Processing by TwilioController#test_start as XML
1723
+ Parameters: {"CallSid"=>"5deadd2a-c9ed-41fb-b9f8-f58391fded2c", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1724
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1725
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1726
+ Processing by TwilioController#test_start as XML
1727
+ Parameters: {"CallSid"=>"f6919da8-bfe8-41a3-9f4b-747c32d20a1a", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1728
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1729
+ Started POST "/twilio/test_start" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1730
+ Processing by TwilioController#test_start as XML
1731
+ Parameters: {"CallSid"=>"51ccc0dd-4121-4a9a-8bda-7fbf1f7c16b0", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"human"}
1732
+ Completed 200 OK in 0ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1733
+ Started GET "/twilio/test_start?format=xml&CallSid=1234567&From=2065551212&Digits=&To=2065553434&AnsweredBy=machine" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1734
+ Processing by TwilioController#test_start as XML
1735
+ Parameters: {"CallSid"=>"1234567", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"machine"}
1736
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1737
+ Started GET "/twilio/test_start?format=xml&CallSid=1234567&From=2065551212&Digits=&To=2065553434&AnsweredBy=machine" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1738
+ Processing by TwilioController#test_start as XML
1739
+ Parameters: {"CallSid"=>"1234567", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"machine"}
1740
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1741
+ Started GET "/twilio/test_start?format=xml&CallSid=1234567&From=2065551212&Digits=&To=2065553434&AnsweredBy=machine" for 127.0.0.1 at 2013-03-13 07:43:20 -0700
1742
+ Processing by TwilioController#test_start as XML
1743
+ Parameters: {"CallSid"=>"1234567", "From"=>"2065551212", "Digits"=>"", "To"=>"2065553434", "AnsweredBy"=>"machine"}
1744
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
@@ -235,7 +235,7 @@ describe TwilioTestToolkit::CallScope do
235
235
  @call.current_path.should == test_action_twilio_index_path
236
236
 
237
237
  # This view says the digits we pressed - make sure
238
- @call.should have_say "You entered 98765"
238
+ @call.should have_say "You entered 98765."
239
239
  end
240
240
 
241
241
  it "should gather without a press" do
@@ -246,8 +246,38 @@ describe TwilioTestToolkit::CallScope do
246
246
  # We should still be on the same page
247
247
  @call.current_path.should == test_start_twilio_index_path
248
248
  end
249
+
250
+ it "should respond to the default finish key of hash" do
251
+ @call.within_gather do |gather|
252
+ gather.press "98765#"
253
+ end
254
+ @call.should have_say "You entered 98765."
255
+ end
249
256
  end
250
257
 
258
+ describe "with finishOnKey specified" do
259
+ before(:each) do
260
+ @call = ttt_call(test_gather_finish_on_asterisk_twilio_index_path, @our_number, @their_number)
261
+ end
262
+
263
+ it "should strip the finish key from the digits" do
264
+ @call.within_gather do |gather|
265
+ gather.press "98765*"
266
+ end
267
+
268
+ @call.should have_say "You entered 98765."
269
+ end
270
+
271
+ it "should still accept the digits without a finish key (due to timeout)" do
272
+ @call.within_gather do |gather|
273
+ gather.press "98765"
274
+ end
275
+
276
+ @call.should have_say "You entered 98765."
277
+ end
278
+
279
+ end
280
+
251
281
  describe "failure" do
252
282
  before(:each) do
253
283
  @call = ttt_call(test_say_twilio_index_path, @our_number, @their_number)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-test-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
12
+ date: 2013-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
@@ -163,6 +163,7 @@ files:
163
163
  - spec/dummy/app/views/layouts/twilio.layout.xml.erb
164
164
  - spec/dummy/app/views/twilio/test_action.xml.erb
165
165
  - spec/dummy/app/views/twilio/test_dial.xml.erb
166
+ - spec/dummy/app/views/twilio/test_gather_finish_on_asterisk.xml.erb
166
167
  - spec/dummy/app/views/twilio/test_hangup.xml.erb
167
168
  - spec/dummy/app/views/twilio/test_play.xml.erb
168
169
  - spec/dummy/app/views/twilio/test_redirect.xml.erb
@@ -232,6 +233,7 @@ test_files:
232
233
  - spec/dummy/app/views/layouts/twilio.layout.xml.erb
233
234
  - spec/dummy/app/views/twilio/test_action.xml.erb
234
235
  - spec/dummy/app/views/twilio/test_dial.xml.erb
236
+ - spec/dummy/app/views/twilio/test_gather_finish_on_asterisk.xml.erb
235
237
  - spec/dummy/app/views/twilio/test_hangup.xml.erb
236
238
  - spec/dummy/app/views/twilio/test_play.xml.erb
237
239
  - spec/dummy/app/views/twilio/test_redirect.xml.erb