Sha256: c2cb25b43d75bde63edf03d2de069a3681ed2b3bab8771cc1d42f0fb69aa3053

Contents?: true

Size: 1.9 KB

Versions: 4

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

Soaspec.strip_namespaces = true # This allows namespace not to be used. Be careful with this

id = '70070010'
# BLZService.new(template_name: 'soap_template') Use this instead of default_hash to use template approach

context 'Test Examples' do
  context BLZService.new('Get Bank', operation: :get_bank, default_hash: { blz: id }) do

    describe Exchange.new(:default) do
      it { is_expected.to contain_value id }
      it { is_expected.to include_in_body id }
      it_behaves_like 'success scenario'
      after(:all) { described_class.store(:title, 'bezeichnung') }
    end

    describe Exchange.new(:xpath_eg, blz: 100000) do
      its(['plz']) { is_expected.to eq '100000' }
      it { is_expected.to have_xpath_value '//ns1:bezeichnung' => 'Deutsche Bank' }
      context 'Handle retrieving stored value' do
        it { is_expected.to have_xpath_value 'bezeichnung' => described_class.retrieve(:title) }
      end
    end

    describe Exchange.new(:yaml_eg, data_for(:small_id)) do
      it_behaves_like 'success scenario'
    end

    # Retry for success more for web services that intermittently fail
    describe Exchange.new(:short_hand_xpath).retry_for_success do
      # Be careful. If you call a method that does not use namespaces, calling one that does may not find the element
      its(['ns1:bezeichnung']) { is_expected.to eq 'Deutsche Bank' } # '//' is not required at the beginning
    end
    describe Exchange.new('Check existence of elements') do
      it { is_expected.to have_element_at_xpath '//ns1:bezeichnung' }
      it { is_expected.not_to have_element_at_xpath '//ns1:bezeichnung_pretend' }
    end
  end
end

error_example = BLZService.new('Error example')
error_example.operation = :get_bank
error_example.default_hash = {}

context 'Error Examples' do
  context error_example do
    describe Exchange.new(:no_blz_error) do
      it_behaves_like 'error scenario'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soaspec-0.0.81 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.0.80 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.0.79 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.0.78 lib/soaspec/generator/spec/soap_spec.rb.erb