Sha256: bd5323e9144f09e4506189eba42dae39a677889ddabaf43cc29986d3303967dc

Contents?: true

Size: 1.81 KB

Versions: 61

Compression:

Stored size: 1.81 KB

Contents

require 'spec_helper'

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

61 entries across 61 versions & 1 rubygems

Version Path
soaspec-0.3.11 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.10 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.9 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.8 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.7 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.6 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.3 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.2 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.3.1 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.32 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.31 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.30 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.29 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.28 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.27 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.26 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.25 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.23 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.22 lib/soaspec/generator/spec/soap_spec.rb.erb
soaspec-0.2.21 lib/soaspec/generator/spec/soap_spec.rb.erb