Sha256: 5f9d93625f9f77293b0ce0148faf31f382af9762aa13feaff35f6944837fbaa8

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe DataExtParams do
  describe '#to_data_extension' do
    it 'converts an Array of Hashes based on key field' do
      expect(DataExtParams.new(:uga).transform([{uga: 1, buga: 2}, {uga: 3, buga: 4}])).
          to eq [{keys: {'Uga' => 1}, values: {'Buga' => 2}},
                 {keys: {'Uga' => 3}, values: {'Buga' => 4}}]
    end
    it 'converts an Array of Hashes based on key_field with no snake_to_camel' do
      expect(DataExtParams.new(:uga, snake_to_camel: false).transform([{uga: 1, buga: 2}, {uga: 3, buga: 4}])).
          to eq [{keys: {uga: 1}, values: {buga: 2}},
                 {keys: {uga: 3}, values: {buga: 4}}]
    end
    it 'converts a simple Hash' do
      expect(DataExtParams.new(:uga).transform(uga: 1, buga: 2)).
          to eq [{keys: {'Uga' => 1}, values: {'Buga' => 2}}]
    end
    it 'converts with multiple key fields' do
      expect(DataExtParams.new('uga', 'buga').transform(uga: 1, buga: 2, turuga: 3, kabuga: 4)).
          to eq [{keys: {'Uga' => 1, 'Buga' => 2}, values: {'Turuga' => 3, 'Kabuga' => 4}}]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
exact_target_rest-0.2.6 spec/lib/exact_target_rest/support/data_ext_params_spec.rb
exact_target_rest-0.2.5 spec/lib/exact_target_rest/support/data_ext_params_spec.rb
exact_target_rest-0.2.4 spec/lib/exact_target_rest/support/data_ext_params_spec.rb
exact_target_rest-0.2.2 spec/lib/exact_target_rest/support/data_ext_params_spec.rb
exact_target_rest-0.1.1 spec/lib/exact_target_rest/support/data_ext_params_spec.rb
exact_target_rest-0.1.0 spec/lib/exact_target_rest/support/data_ext_params_spec.rb