Sha256: aa4659698b912655b6239ba783a4702c83eb440b439649d6a96c799176d75899

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe 'UnityResponse' do
  it_behaves_like 'a unity response'

  subject { build(:unity_response, response: get_server_info) }

  let(:get_server_info) { FixtureLoader.load_yaml('get_server_info_xml.yml') }

  describe '#initialize' do
    context 'when nil is given for response' do
      it { expect { build(:unity_response, response: nil) }.to raise_error(ArgumentError) }
    end

    context 'when nil is given for timezone' do
      it { expect { build(:unity_response, timezone: nil) }.to raise_error(ArgumentError) }
    end
  end

  describe '#to_hash' do
    context 'when given a GetServerInfo SOAP response hash' do
      it 'strips Unity SOAP wrappers' do
        expect(subject.to_hash[:server_time_zone]).to_not be_nil
      end

      context 'when given nil magic_result' do
        it 'returns []' do
          magic_response = get_server_info
          magic_response[:magic_response][:magic_result][:diffgram] = nil
          subject.response = magic_response
          expect(subject.to_hash).to eq([])
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
allscripts_unity_client-2.0.5 spec/unity_response_spec.rb
allscripts_unity_client-2.0.4 spec/unity_response_spec.rb
allscripts_unity_client-2.0.3 spec/unity_response_spec.rb
allscripts_unity_client-2.0.2 spec/unity_response_spec.rb
allscripts_unity_client-2.0.1 spec/unity_response_spec.rb
allscripts_unity_client-2.0.0 spec/unity_response_spec.rb