From 4dfc114119fc1ca2132e3a6095a398e20de96ad2 Mon Sep 17 00:00:00 2001 From: Jon Gilbraith Date: Wed, 13 Mar 2013 14:15:42 +0000 Subject: [PATCH] Implement a default finish key of hash. --- lib/twilio-test-toolkit/call_scope.rb | 2 +- spec/requests/call_scope_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/twilio-test-toolkit/call_scope.rb b/lib/twilio-test-toolkit/call_scope.rb index f8909d6..13cad41 100644 --- a/lib/twilio-test-toolkit/call_scope.rb +++ b/lib/twilio-test-toolkit/call_scope.rb @@ -86,7 +86,7 @@ def gather_method def gather_finish_on_key raise "Not a gather" unless gather? - return @xml["finishOnKey"] + return @xml["finishOnKey"] || '#' # '#' is the default finish key if not specified end def press(digits) diff --git a/spec/requests/call_scope_spec.rb b/spec/requests/call_scope_spec.rb index c1fceef..a0c93d8 100644 --- a/spec/requests/call_scope_spec.rb +++ b/spec/requests/call_scope_spec.rb @@ -246,6 +246,13 @@ # We should still be on the same page @call.current_path.should == test_start_twilio_index_path end + + it "should respond to the default finish key of hash" do + @call.within_gather do |gather| + gather.press "98765#" + end + @call.should have_say "You entered 98765." + end end describe "with finishOnKey specified" do