Sha256: 025bd1873b1568677ff5ab51a64b54b8a706caa7ce88949ff0883c8f842f61ba

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe ActiveForce::Field do
  let(:field) { ActiveForce::Field }

  describe 'initialize' do
    let(:some_field) { field.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 = field.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 field is' do
    it 'a datetime should return a string like "YYYY-MM-DDTHH:MM:SSZ"' do
      current_time = DateTime.now
      names = field.new(:time, as: :datetime)
      expect(names.value_for_hash current_time).to eq current_time.to_fs(:iso8601)
    end

    it 'a datetime field whose value is nil' do
      current_time = nil
      names = field.new(:time, as: :datetime)
      expect(names.value_for_hash current_time).to be_nil
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
active_force-0.24.0 spec/active_force/field_spec.rb
active_force-0.23.0 spec/active_force/field_spec.rb
active_force-0.22.1 spec/active_force/field_spec.rb
active_force-0.22.0 spec/active_force/field_spec.rb
active_force-0.21.0 spec/active_force/field_spec.rb
active_force-0.20.1 spec/active_force/field_spec.rb
active_force-0.20.0 spec/active_force/field_spec.rb
active_force-0.19.0 spec/active_force/field_spec.rb
active_force-0.18.0 spec/active_force/field_spec.rb
active_force-0.17.0 spec/active_force/field_spec.rb
active_force-0.16.0 spec/active_force/field_spec.rb
active_force-0.15.1 spec/active_force/field_spec.rb
active_force-0.15.0 spec/active_force/field_spec.rb