Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for the 'Play' TwiML verb. #3

Merged
merged 1 commit into from

2 participants

@jongilbraith

No description provided.

@JMongol JMongol merged commit 091b512 into JMongol:master
@JMongol
Owner

Thanks!

@jongilbraith

Crazy fast merge!

Thanks Jack. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2013
  1. Add support for the 'Play' TwiML verb.

    Jon Gilbraith authored
This page is out of date. Refresh to see the latest.
View
2  README.md
@@ -34,13 +34,13 @@ What's supported
TTT supports most of the more common Twilio scenarios:
* Checking for Say elements and their content
+* Checking for Play elements and their content
* Taking action on Gather elements and querying their contents
* Following and querying redirects
* Dial and Hangup
TTT doesn't yet support (but you should contribute them!)
-* Play
* Queue
* Any of the other conference calling features
View
9 lib/twilio-test-toolkit/call_scope.rb
@@ -31,6 +31,15 @@ def has_say?(say)
return false
end
+ # Stuff for Plays
+ def has_play?(play)
+ @xml.xpath("Play").each do |s|
+ return true if s.inner_text == play
+ end
+
+ return false
+ end
+
# Stuff for Dials
def has_dial?(number)
@xml.xpath("Dial").each do |s|
View
1  spec/dummy/app/views/twilio/test_play.xml.erb
@@ -0,0 +1 @@
+<Play>/path/to/an/audio/clip.mp3</Play>
View
3  spec/dummy/config/routes.rb
@@ -8,5 +8,6 @@
post "test_dial", :on => :collection
post "test_redirect", :on => :collection
post "test_say", :on => :collection
- end
+ post "test_play", :on => :collection
+ end
end
View
16 spec/requests/call_scope_spec.rb
@@ -124,6 +124,22 @@
end
end
+ describe "play" do
+ before(:each) do
+ @call = ttt_call(test_play_twilio_index_path, @our_number, @their_number)
+ end
+
+ it "should have the expected say play methods" do
+ @call.should respond_to(:has_play?)
+ end
+
+ it "should have the right values for has_say?" do
+ @call.has_play?("/path/to/a/different/audio/clip.mp3").should be_false
+ @call.has_play?("/path/to/an/audio/clip.mp3").should be_true
+ @call.has_play?("clip.mp3").should be_false
+ end
+ end
+
describe "dial" do
before(:each) do
@call = ttt_call(test_dial_twilio_index_path, @our_number, @their_number)
Something went wrong with that request. Please try again.