Sha256: 43ea6d040c457c9f2927c1bdcc2e3cc7b8eb9763f8285999f2b2a4487cce717d

Contents?: true

Size: 1.08 KB

Versions: 23

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe AllscriptsUnityClient::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

23 entries across 23 versions & 1 rubygems

Version Path
allscripts_unity_client-3.4.1 spec/unity_response_spec.rb
allscripts_unity_client-3.4.0 spec/unity_response_spec.rb
allscripts_unity_client-3.3.1 spec/unity_response_spec.rb
allscripts_unity_client-3.3.0 spec/unity_response_spec.rb
allscripts_unity_client-3.2.2 spec/unity_response_spec.rb
allscripts_unity_client-3.2.1 spec/unity_response_spec.rb
allscripts_unity_client-3.2.0 spec/unity_response_spec.rb
allscripts_unity_client-3.1.3 spec/unity_response_spec.rb
allscripts_unity_client-3.1.2 spec/unity_response_spec.rb
allscripts_unity_client-3.1.1 spec/unity_response_spec.rb
allscripts_unity_client-3.1.0 spec/unity_response_spec.rb
allscripts_unity_client-3.0.0 spec/unity_response_spec.rb
allscripts_unity_client-2.2.4 spec/unity_response_spec.rb
allscripts_unity_client-2.2.3 spec/unity_response_spec.rb
allscripts_unity_client-2.2.2 spec/unity_response_spec.rb
allscripts_unity_client-2.2.0 spec/unity_response_spec.rb
allscripts_unity_client-2.1.6 spec/unity_response_spec.rb
allscripts_unity_client-2.1.5 spec/unity_response_spec.rb
allscripts_unity_client-2.1.4 spec/unity_response_spec.rb
allscripts_unity_client-2.1.3 spec/unity_response_spec.rb