Sha256: 544304dcee9c47bd37b2b5ec995dbebbab631be07a818ede33f67bc7f80d13b5

Contents?: true

Size: 1.17 KB

Versions: 40

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

class UtilClass
  include Twilio::REST::Utils
end

describe UtilClass do
  subject(:util) { UtilClass.new }

  it 'should convert a parameter name to a Twilio-style name' do
    expect(util.twilify('sms_url')).to eq('SmsUrl')
  end

  it 'should convert all parameter names to Twilio-style names' do
    untwilified = {
      :sms_url => 'someUrl',
      'voiceFallbackUrl' => 'anotherUrl',
      'Status_callback' => 'yetAnotherUrl'
    }
    twilified = {
      :SmsUrl => 'someUrl',
      :VoiceFallbackUrl => 'anotherUrl',
      :StatusCallback => 'yetAnotherUrl'
    }
    expect(util.twilify(untwilified)).to eq(twilified)
  end

  it 'should convert a Twilio-style name to a parameter name' do
    expect(util.detwilify('SmsUrl')).to eq('sms_url')
  end

  it 'should convert all Twilio-style names to parameter names' do
    untwilified = {
      :sms_url => 'someUrl',
      :voice_fallback_url => 'anotherUrl',
      :status_callback => 'yetAnotherUrl'
    }
    twilified = {
      :SmsUrl => 'someUrl',
      :VoiceFallbackUrl => 'anotherUrl',
      :StatusCallback => 'yetAnotherUrl'
    }
    expect(util.detwilify(twilified)).to eq(untwilified)
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
twilio-ruby-4.13.0 spec/rest/utils_spec.rb
twilio-ruby-4.12.1 spec/rest/utils_spec.rb
twilio-ruby-4.11.1 spec/rest/utils_spec.rb
twilio-ruby-4.11.0 spec/rest/utils_spec.rb
twilio-ruby-4.10.0.edge spec/rest/utils_spec.rb
twilio-ruby-4.10.0 spec/rest/utils_spec.rb
twilio-ruby-4.9.1 spec/rest/utils_spec.rb
twilio-ruby-4.9.1.edge spec/rest/utils_spec.rb
twilio-ruby-4.9.0 spec/rest/utils_spec.rb
twilio-ruby-4.9.0.edge spec/rest/utils_spec.rb
twilio-ruby-4.8.0 spec/rest/utils_spec.rb
twilio-ruby-4.7.0 spec/rest/utils_spec.rb
twilio-ruby-4.8.3.edge spec/rest/utils_spec.rb
twilio-ruby-4.8.2.edge spec/rest/utils_spec.rb
twilio-ruby-4.8.1.edge spec/rest/utils_spec.rb
twilio-ruby-4.8.0.edge spec/rest/utils_spec.rb
twilio-ruby-4.6.2 spec/rest/utils_spec.rb
twilio-ruby-4.6.1 spec/rest/utils_spec.rb
twilio-ruby-4.6.0 spec/rest/utils_spec.rb
twilio-ruby-4.7.0.edge spec/rest/utils_spec.rb