Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3 from globaldev/play

Add support for the 'Play' TwiML verb.
  • Loading branch information...
commit 091b512619073803c65091b3020530195ab21de3 2 parents 14958ff + 4f2d50e
Jack Nichols authored
2  README.md
View
@@ -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
9 lib/twilio-test-toolkit/call_scope.rb
View
@@ -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|
1  spec/dummy/app/views/twilio/test_play.xml.erb
View
@@ -0,0 +1 @@
+<Play>/path/to/an/audio/clip.mp3</Play>
3  spec/dummy/config/routes.rb
View
@@ -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
16 spec/requests/call_scope_spec.rb
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.