Sha256: df9448380cdd2c035022b0fcaaaa2aef56aa0d57ec9e143e692f89ce859671ce
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' module ActiveForce describe SObject do let(:client){ double "client" } before do ActiveForce.sfdc_client = client end describe '.select' do it 'has correct fields in query' do query = Territory.select(:name, :id) expect(query.fields).to eq(["Name", "Id"]) end context 'when getting the value of an uninitialized attribute' do let(:territory) { Territory.select(:id).first } let(:response) do [build_restforce_sobject({ "Id" => "123", "Quota__c" => "321", })] end before do allow(client).to receive(:query).once.and_return response end it 'raises missing attribute error if uninitialized variable is called' do expect{territory.name}.to raise_error(ActiveModel::MissingAttributeError) end it 'returns SObjects with Uninitialized Value' do expect(territory.instance_variable_get(:@attributes)["name"]).to be_an_instance_of(ActiveModel::Attribute::UninitializedValue) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems