Skip to content
Browse files

Add a spec to cover a gather with finishOnKey specified.

  • Loading branch information...
1 parent 90dced5 commit daa3bb772f8ccc2153b802cc3c9e6feb9cebf8f7 Jon Gilbraith committed Mar 12, 2013
View
3 spec/dummy/app/views/twilio/test_gather_finish_on_asterisk.xml.erb
@@ -0,0 +1,3 @@
+<Gather finishOnKey="*" action="<%= test_action_twilio_index_path %>" method="post">
+ <Say>Please enter some digits followed by hash.</Say>
+</Gather>
View
1 spec/dummy/config/routes.rb
@@ -4,6 +4,7 @@
post "test_start", :on => :collection
post "test_action", :on => :collection
+ post "test_gather_finish_on_asterisk", :on => :collection
post "test_hangup", :on => :collection
post "test_dial", :on => :collection
post "test_redirect", :on => :collection
View
23 spec/requests/call_scope_spec.rb
@@ -248,6 +248,29 @@
end
end
+ describe "with finishOnKey specified" do
+ before(:each) do
+ @call = ttt_call(test_gather_finish_on_asterisk_twilio_index_path, @our_number, @their_number)
+ end
+
+ it "should strip the finish key from the digits" do
+ @call.within_gather do |gather|
+ gather.press "98765*"
+ end
+
+ @call.should have_say "You entered 98765."
+ end
+
+ it "should still accept the digits without a finish key (due to timeout)" do
+ @call.within_gather do |gather|
+ gather.press "98765"
+ end
+
+ @call.should have_say "You entered 98765."
+ end
+
+ end
+
describe "failure" do
before(:each) do
@call = ttt_call(test_say_twilio_index_path, @our_number, @their_number)

0 comments on commit daa3bb7

Please sign in to comment.
Something went wrong with that request. Please try again.