Sha256: 5baa84debc3d714b9c9b6408e56dd1741772c766b50a14a8157a7e41b69d236a
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' module Telephony describe TwilioClientController do render_views before do @routes = Engine.routes end describe '#index' do before do get :index end it 'renders the twilio client page' do response.should be_ok response.content_type.should == "text/html" end end describe '#token' do context 'by default' do before do controller.should_receive(:generate_token_for) .with("agent123") .and_return("a_new_token") get :token, { csr_id: 123 } end it 'returns the Twilio Client capability token' do response.should be_ok response.content_type.should == "application/json" data = JSON.parse(response.body) data['token'].should == "a_new_token" end end context 'given an invalid csr id' do before do get :token end it 'returns a 400 response' do response.code.should == "400" end it 'returns an error message as JSON' do json = JSON response.body json.should include('errors') errors = json['errors'] errors.should have(1).error errors[0].should == 'Invalid csr id' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
telephony-1.0.4 | spec/controllers/telephony/twilio_client_controller_spec.rb |
telephony-1.0.3 | spec/controllers/telephony/twilio_client_controller_spec.rb |