Sha256: a080f1908e5295b66c7e6c358129f185e7e2f0c32eab7b6d9dd93403cd06f96f

Contents?: true

Size: 863 Bytes

Versions: 5

Compression:

Stored size: 863 Bytes

Contents

require 'test/unit'
require 'fakeweb'
require 'shoulda'
require 'yaml'
require 'twilio'

FakeWeb.allow_net_connect = false

class Test::Unit::TestCase #:nodoc: all
end

def fixture(filename) #:nodoc:
  path = File.join(File.dirname(__FILE__), "fixtures/xml/#{filename}.xml")
  File.read path
end

def stub_response(verb, fixture_name, options = {}) #:nodoc:
  fake_response = fixture(fixture_name)
  resource = options.delete(:resource)
  options = { :body => fake_response }.merge(options)
  FakeWeb.register_uri(verb, twilio_url(resource), options)
  
  fake_response
end

def twilio_url(url=nil) #:nodoc:
  "https://mysid:mytoken@api.twilio.com:443/2008-08-01/Accounts/mysid#{'/' + url if url}"
end

def verb_response(verb) #:nodoc:
  path = File.join(File.dirname(__FILE__), "fixtures/yml/verb_responses.yml")
  YAML.load_file(path)[verb.to_s]['response']
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twilio-2.8.0 test/test_helper.rb
twilio-2.7.0 test/test_helper.rb
twilio-2.6.0 test/test_helper.rb
twilio-2.5.0 test/test_helper.rb
twilio-2.4.1 test/test_helper.rb