Sha256: 2b30b72591fe2317e9c0dbdbf2e7a1d61b497a2e456574bca08c8da34a2fe991

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

shared_examples 'a unity response' do
  let(:attributes_hash) { FixtureLoader.load_yaml('attributes_hash.yml') }
  let(:no_attributes_hash) { FixtureLoader.load_yaml('no_attributes_hash.yml') }
  let(:date_string_hash) { FixtureLoader.load_yaml('date_string_hash.yml') }
  let(:date_hash) { FixtureLoader.load_yaml('date_hash.yml') }

  describe '#strip_attributes' do
    context 'when given nil' do
      it { expect(subject.send(:strip_attributes, nil)).to be_nil }
    end

    it 'recursively strips attribute keys off hashes' do
      expect(subject.send(:strip_attributes, attributes_hash)).to eq(no_attributes_hash)
    end
  end

  describe '#convert_dates_to_utc' do
    context 'when given nil' do
      it { expect(subject.send(:convert_dates_to_utc, nil)).to be_nil }
    end

    it 'recursively converts date strings' do
      expect(subject.send(:convert_dates_to_utc, date_string_hash)).to eq(date_hash)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
allscripts_unity_client-4.0.1 spec/support/shared_examples_for_unity_response.rb
allscripts_unity_client-4.0.0 spec/support/shared_examples_for_unity_response.rb