spec/api_spec.rb in cdyne-sms-notify-0.8.4 vs spec/api_spec.rb in cdyne-sms-notify-0.8.5
- old
+ new
@@ -1,8 +1,34 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
module SmsNotify
+ class Api
+ class Command
+ def execute(parameters)
+ '<?xml version="1.0" encoding="utf-8"?>
+<ArrayOfSmsResponse xmlns="http://ws.cdyne.com/SmsWS/">
+ <SmsResponse>
+ <ResponseID>293948</ResponseID>
+ <TextID>32934</TextID>
+ <StatusCode>2</StatusCode>
+ <ReceivedDate></ReceivedDate>
+ <Message>Feel the burn</Message>
+ </SmsResponse>
+ <SmsResponse>
+ <ResponseID>293950</ResponseID>
+ <TextID>32934</TextID>
+ <StatusCode>5</StatusCode>
+ <ReceivedDate></ReceivedDate>
+ <Message>You got it</Message>
+ </SmsResponse>
+</ArrayOfSmsResponse>'
+ end
+ end
+ end
+end
+
+module SmsNotify
describe "Api" do
before(:each) do
@api = Api.new('key')
end
@@ -15,10 +41,16 @@
end
it "should respond to send_message" do
@api.respond_to?('send_message').should be true
end
+
+ describe "message_responses" do
+ it "should return an array of MessageResponse objects" do
+ @api.message_responses('1234')
+ end
+ end
describe "Api Command" do
before(:each) do
@command = Api::Command.new('cmdname', 'key')
end
@@ -32,6 +64,6 @@
url = @command.build_url(:fu => 'b a r', :sna => 'f&u')
url.should == URI.parse('https://ws.cdyne.com/SmsWs/SMS.asmx/cmdname?LicenseKey=key&fu=b+a+r&sna=f%26u')
end
end
end
-end
\ No newline at end of file
+end