Skip to content

Instantly share code, notes, and snippets.

@renemendoza
Created August 29, 2012 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renemendoza/3518860 to your computer and use it in GitHub Desktop.
Save renemendoza/3518860 to your computer and use it in GitHub Desktop.
### spec
let(:mock_call) { double 'Call' }
let(:test_extension) { 'ad57366865126e55649ecb23ae1d48887544976efea46a48eb5d85a6eeb4d306' }
let(:test_token) { '76f50757ad538f4e34cef18cb13b40248e68854a99a040c2c9b057d65b541402' }
subject do
#mock_call.stub(:variables) {{}}
CallRouterController.new mock_call
end
it 'retrieves extension and token' do
subject.should_receive(:get_variable).with('EXTEN').and_return(:test_extension)
subject.should_receive(:sip_get_header).with('x-llamarada-token').and_return(:test_token)
#subject.call.variables[:extension].should_not be_nil
subject.retrieve_credentials
end
### call controller
def retrieve_credentials
self[:extension] = get_variable('EXTEN')
self[:token] = sip_get_header('x-llamarada-token')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment