Skip to content

Instantly share code, notes, and snippets.

@coderguy
Last active January 18, 2016 20:00
Show Gist options
  • Save coderguy/fca6829e41a23ac4bbb0 to your computer and use it in GitHub Desktop.
Save coderguy/fca6829e41a23ac4bbb0 to your computer and use it in GitHub Desktop.
Factories for testing twilio
FactoryGirl.define do
factory :voice_request, class: Hash do
defaults = {
Called: '+15125550198',
Digits: '',
RecordingUrl: '',
ToState: 'TX',
CallerCountry: 'US',
Direction: 'inbound',
CallerState: 'TX',
ToZip: '78701',
CallSid: 'CA02641f076b0cc3a17a1693616838ecf7',
To: '+15125550198',
CallerZip: '73301',
ToCountry: 'US',
ApiVersion: '2010-04-01',
CalledZip: '78701',
CalledCity: 'AUSTIN',
CallStatus: 'completed',
RecordingSid: 'RE02641f076b0cc3a17a1693616838ecf7',
From: '+15123330181',
AccountSid: 'AC02641f076b0cc3a17a1693616838ecf7',
CalledCountry: 'US',
CallerCity: 'AUSTIN',
Caller: '+15123330181',
FromCountry: 'US',
ToCity: 'AUSTIN',
FromCity: 'AUSTIN',
CalledState: 'TX',
FromZip: '73301',
FromState: 'TX',
RecordingDuration: '3'
}
initialize_with{ defaults.merge(attributes) }
end
factory :sms_request, class: Hash do
defaults = {
ToCountry: 'US',
ToState: 'TX',
SmsMessageSid: 'SM02641f076b0cc3a17a1693616838ecf7',
NumMedia: '0',
ToCity: 'AUSTIN',
FromZip: '73301',
SmsSid: 'SM02641f076b0cc3a17a1693616838ecf7',
FromState: 'TX',
SmsStatus: 'received',
FromCity: 'AUSTIN',
Body: 'Hello World!',
FromCountry: 'US',
To: '+15125550198',
ToZip: '78701',
MessageSid: 'SM02641f076b0cc3a17a1693616838ecf7',
AccountSid: 'AC02641f076b0cc3a17a1693616838ecf7',
From: '+15123330181',
ApiVersion: '2010-04-01'
}
initialize_with{ defaults.merge(attributes) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment