Sha256: a4b49203bda19cffcdb18a6936143cc6683fef34240b1cf07f0f6b88996da2bc

Contents?: true

Size: 1.52 KB

Versions: 10

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Twilio::TwiML::Response do
  it 'should render empty' do
    twiml = Twilio::TwiML::Response.new
    expect(twiml.text).to eq('<?xml version="1.0" encoding="UTF-8"?>' +
                             '<Response/>')
  end

  it 'should render top level tags' do
    twiml = Twilio::TwiML::Response.new do |r|
      r.Say 'hello world'
      r.Hangup
    end
    expect(twiml.text).to eq('<?xml version="1.0" encoding="UTF-8"?>' +
                             '<Response>' +
                               '<Say>hello world</Say>' +
                               '<Hangup/>' +
                             '</Response>')
  end

  it 'should render attributes in top level tags' do
    twiml = Twilio::TwiML::Response.new do |r|
      r.Say 'hello world', voice: 'alice'
    end

    expect(twiml.text).to eq('<?xml version="1.0" encoding="UTF-8"?>' +
                             '<Response>' +
                               '<Say voice="alice">hello world</Say>' +
                             '</Response>')
  end

  it 'should render nested tags' do
    twiml = Twilio::TwiML::Response.new do |r|
      r.Dial callerId: '+14158675309' do |d|
        d.Client 'jenny'
      end
    end

    expect(twiml.text).to eq('<?xml version="1.0" encoding="UTF-8"?>' +
                             '<Response>' +
                               '<Dial callerId="+14158675309">' +
                                 '<Client>jenny</Client>' +
                               '</Dial>' +
                             '</Response>')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
twilio-ruby-5.0.0.rc21 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc20 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc19 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc18 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc17 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc16 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc15 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc14 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc13 spec/twiml/twiml_response_spec.rb
twilio-ruby-5.0.0.rc12 spec/twiml/twiml_response_spec.rb