Sha256: d4907748b8384455102a65c031f48fc3880692da397bcc230a4cc25e427510e6

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

require 'spec_helper'

describe ActiveForce::Attribute do
  let(:attribute) { ActiveForce::Attribute }

  describe 'initialize' do
    let(:some_field) { attribute.new(:some_field) }

    it 'should set "from" and "as" as default' do
      expect(some_field.sfdc_name).to eq 'Some_Field__c'
      expect(some_field.as).to eq :string
    end

    it 'should take values from the option parameter' do
      other_field = attribute.new(:other_field, sfdc_name: 'OT__c', as: :integer)
      expect(other_field.sfdc_name).to eq 'OT__c'
      expect(other_field.as).to eq :integer
    end
  end

  describe 'when the attribute is' do
    it 'a multipick should return all values as 1 string separated with ";"' do
      names = attribute.new(:names, as: :multi_picklist)
      expect(names.value_for_hash ['olvap', 'eloy']).to eq 'olvap;eloy'
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
openstax_active_force-1.1.1 spec/active_force/attribute_spec.rb
openstax_active_force-1.1.0 spec/active_force/attribute_spec.rb
openstax_active_force-1.0.0 spec/active_force/attribute_spec.rb
active_force-0.7.1 spec/active_force/attribute_spec.rb
active_force-0.7.0 spec/active_force/attribute_spec.rb