Sha256: c12a35f36dcd2814fa12648234564375e31fd3a2e86dd3ff00cac78e3c8403e5

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Twilio do
  describe 'prefixed_collapsible_map' do

    it 'should serialize nil' do
      actual = Twilio.prefixed_collapsible_map(nil, 'Prefix')
      expect(actual).to eq({})
    end

    it 'should serialize a single key' do
      actual = Twilio.prefixed_collapsible_map({
        'foo' => 'bar'
      }, 'Prefix')
      expect(actual).to eq({
        'Prefix.foo' => 'bar'
      })
    end

    it 'should serialize nested key' do
      actual = Twilio.prefixed_collapsible_map({
        'foo' => {
          'bar' => 'baz'
        }
      }, 'Prefix')
      expect(actual).to eq({
        'Prefix.foo.bar' => 'baz'
      })
    end

    it 'should serialize multiple keys' do
      actual = Twilio.prefixed_collapsible_map({
        'watson' => {
          'language' => 'en',
          'alice' => 'bob'
        },
          'foo' => 'bar'
      }, 'Prefix')
      expect(actual).to eq({
        'Prefix.watson.language' => 'en',
        'Prefix.watson.alice' => 'bob',
        'Prefix.foo' => 'bar'
      })
    end

    it 'should serialize list' do
      actual = Twilio.prefixed_collapsible_map(['foo', 'bar'], 'Prefix')
      expect(actual).to eq({})
    end


  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
twilio-ruby-5.0.0.rc19 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc18 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc17 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc16 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc15 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc14 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc13 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc12 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc11 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc10 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc9 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc8 spec/framework/serialize_spec.rb
twilio-ruby-5.0.0.rc7 spec/framework/serialize_spec.rb