RSpec Code Examples

 

 

API Command
should return encoded URL for the specified command and parameters
should URL encode any special characters in parameters
should use a custom host when constructing command URLs if specified
should use the default host if specified custom host is nil
should use the default host if specified custom host is an empty string
Secure API Command
should use HTTPS
Command executor
should create an API command with the given params
should send the URI generated by the created command via HTTP get and return the response
should send the command over a secure HTTPS connection if :secure option is set to true
API
should use the api_id, username and password to authenticate and return the new session id
should support ping, using the current session_id
should support sending messages to a specified number, returning the message id
should support sending messages to a multiple numbers, returning the message ids
should set the :from parameter and set the :req_feat to 48 when using a custom from string when sending a message
should set the :mo flag to 1 when :set_mobile_originated is true when sending a message
should set the callback flag to the number passed in the options hash
should set the client message id to the number passed in the options hash
should ignore any invalid parameters when sending a message
should support message status query for a given message id, returning the message status
should support balance query, returning number of credits as a float
should raise an API::Error if the response parser raises
Clickatell::API when authenticating
should authenticate to retrieve a session_id and return a new API instance using that session id
Clickatell::API with no authentication options set
should build commands with no authentication options
Clickatell::API in secure mode
should execute commands securely
API Error
should parse http response string to create error
Clickatell::API#test_mode
should create a new CommandExecutor with test_mode parameter set to true
should record all commands
should return the recorded commands in a flattened array
CLI options when sending a message
should allow single recipients
should allow multiple, comma-separated recipients
should strip + symbols from the beginning of numbers
CLI options when checking balance
should not require a recipient
API::CommandExecutor
should have test mode
should default to not test mode
API::CommandExecutor#execute in non-test mode
should not record requests
API::CommandExecutor#execute in non-test mode without a proxy
should execute commands through the proxy
API::CommandExecutor#execute in non-test mode with a proxy
should execute commands through the proxy
API::CommandExecutor#execute in test mode
should not make any network calls
should start with an empty request collection
should record sms requests
should record a request for each call
should return a response that approximates a true Net::HttpResponse
API::CommandExecutor#execute in test mode each recorded request
should return the command information
Hash
should return only the keys specified
should return only the keys specified, ignoring keys that do not exist
Response parser
should return hash for one-line success response
should return array of hashes for multi-line success response
should raise API::Error if response contains an error message
should parse a message status code of 6 when the response body contains a status code of 006
should parse a message status code of 7 when the response body contains a status code of 007
should parse a message status code of 8 when the response body contains a status code of 008
should parse a message status code of 9 when the response body contains a status code of 009
should parse a message status code of 10 when the response body contains a status code of 010
should parse a message status code of 11 when the response body contains a status code of 011
should parse a message status code of 12 when the response body contains a status code of 012
should parse a message status code of 1 when the response body contains a status code of 001
should parse a message status code of 2 when the response body contains a status code of 002
should parse a message status code of 3 when the response body contains a status code of 003
should parse a message status code of 4 when the response body contains a status code of 004
should parse a message status code of 5 when the response body contains a status code of 005
Response parser in test mode
should return something approximating a session_id