Sha256: aa28066e4f17f006b36bf9c060bd21f9e8d9cd85b55a4105fdb940743e5e52e0

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe 'UnityResponse' do
  it_behaves_like 'a unity response'

  subject { FactoryGirl.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 { FactoryGirl.build(:unity_response, :response => nil) }.to raise_error(ArgumentError) }
    end

    context 'when nil is given for timezone' do
      it { expect { FactoryGirl.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

17 entries across 17 versions & 1 rubygems

Version Path
allscripts_unity_client-1.3.4 spec/unity_response_spec.rb
allscripts_unity_client-1.3.3 spec/unity_response_spec.rb
allscripts_unity_client-1.3.2 spec/unity_response_spec.rb
allscripts_unity_client-1.3.1 spec/unity_response_spec.rb
allscripts_unity_client-1.3.0 spec/unity_response_spec.rb
allscripts_unity_client-1.2.7 spec/unity_response_spec.rb
allscripts_unity_client-1.2.6 spec/unity_response_spec.rb
allscripts_unity_client-1.2.5 spec/unity_response_spec.rb
allscripts_unity_client-1.2.4 spec/unity_response_spec.rb
allscripts_unity_client-1.2.3 spec/unity_response_spec.rb
allscripts_unity_client-1.2.2 spec/unity_response_spec.rb
allscripts_unity_client-1.2.1 spec/unity_response_spec.rb
allscripts_unity_client-1.2.0 spec/unity_response_spec.rb
allscripts_unity_client-1.1.1 spec/unity_response_spec.rb
allscripts_unity_client-1.1.0 spec/unity_response_spec.rb
allscripts_unity_client-1.0.4 spec/unity_response_spec.rb
allscripts_unity_client-1.0.3 spec/unity_response_spec.rb