Sha256: 0bb68a1479cb50c7fb607c91b30e9510c2a5541f2a3ba6fa4ca48dfc21c72b46

Contents?: true

Size: 1.51 KB

Versions: 11

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe AllscriptsUnityClient do
  include Savon::SpecHelper

  subject { described_class }

  describe '.create' do
    context 'when given mode: :soap' do
      it 'returns a SOAPClient' do
        parameters = build(:allscripts_unity_client_parameters, mode: :soap)
        expect(subject.create(parameters).client_type).to be(:soap)
      end
    end

    context 'when given mode: :json' do
      it 'returns a client with client_type :json' do
        parameters = build(:allscripts_unity_client_parameters, mode: :json)
        expect(subject.create(parameters).client_type).to be(:json)
      end
    end

    context 'when not given :mode' do
      it 'returns a client with client_type :soap' do
        parameters = build(:allscripts_unity_client_parameters)
        parameters[:mode] = nil
        expect(subject.create(parameters).client_type).to be(:soap)
      end
    end
  end

  describe '.raise_if_options_invalid' do
    context 'when not given :mode' do
      it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: nil)) }.to raise_error(ArgumentError) }
    end

    context 'when given mode: :json' do
      it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: :json)) }.not_to raise_error }
    end

    context 'when given mode: :soap' do
      it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: :soap)) }.not_to raise_error }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
allscripts_unity_client-2.2.4 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.2.3 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.2.2 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.2.0 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.6 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.5 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.4 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.3 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.2 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.1 spec/allscripts_unity_client_spec.rb
allscripts_unity_client-2.1.0 spec/allscripts_unity_client_spec.rb