<commit_before>require 'spec_helper'

describe Ibanomat do
  describe :find do
    subject {
      Ibanomat.find :bank_code => '37040044', :bank_account_number => '0532013000'
    }

    context 'Webservice is live' do
      context 'returns valid IBAN' do
        before :each do
          json_response = {
            'Institutsname'          => 'Commerzbank',
            'BIC'                    => 'COBADEFFXXX',
            'BLZ'                    => '37040044',
            'IBAN'                   => 'DE89370400440532013000',
            'KtoNr'                  => '0532013000',
            'RetCode'                => '00'
          }.to_json

          stub_request(:get, Ibanomat::URL).
            with(:query => {
              'bank-code'           => '37040044',
              'bank-account-number' => '0532013000'
            }).
            to_return(:status => 200, :body => json_response)
        end

        it 'should return bank_name' do
          subject[:bank_name].should == 'Commerzbank'
        end

        it 'should return BIC' do
          subject[:bic].should == 'COBADEFFXXX'
        end

        it 'should return IBAN' do
          subject[:iban].should == 'DE89370400440532013000'
        end
      end

      context 'can not calculate IBAN' do
        before :each do
          json_response = {
            'BLZ'                    => '37040044',
            'KtoNr'                  => '0532013000',
            'RetCode'                => '10'
          }.to_json

          stub_request(:get, Ibanomat::URL).
            with(:query => {
              'bank-code'           => '37040044',
              'bank-account-number' => '0532013000'
            }).
            to_return(:status => 200, :body => json_response)
        end

        it 'should return error code' do
          subject[:return_code].should == '10'
        end
      end
    end

    context 'Webservice not found' do
      before :each do
        stub_request(:get, Ibanomat::URL).
          with(:query => {
            'bank-code'           => '37040044',<commit_msg>Convert specs to RSpec 2.99.0 syntax with Transpec<commit_after>require 'spec_helper'

describe Ibanomat do
  describe :find do
    subject {
      Ibanomat.find :bank_code => '37040044', :bank_account_number => '0532013000'
    }

    context 'Webservice is live' do
      context 'returns valid IBAN' do
        before :each do
          json_response = {
            'Institutsname'          => 'Commerzbank',
            'BIC'                    => 'COBADEFFXXX',
            'BLZ'                    => '37040044',
            'IBAN'                   => 'DE89370400440532013000',
            'KtoNr'                  => '0532013000',
            'RetCode'                => '00'
          }.to_json

          stub_request(:get, Ibanomat::URL).
            with(:query => {
              'bank-code'           => '37040044',
              'bank-account-number' => '0532013000'
            }).
            to_return(:status => 200, :body => json_response)
        end

        it 'should return bank_name' do
          expect(subject[:bank_name]).to eq('Commerzbank')
        end

        it 'should return BIC' do
          expect(subject[:bic]).to eq('COBADEFFXXX')
        end

        it 'should return IBAN' do
          expect(subject[:iban]).to eq('DE89370400440532013000')
        end
      end

      context 'can not calculate IBAN' do
        before :each do
          json_response = {
            'BLZ'                    => '37040044',
            'KtoNr'                  => '0532013000',
            'RetCode'                => '10'
          }.to_json

          stub_request(:get, Ibanomat::URL).
            with(:query => {
              'bank-code'           => '37040044',
              'bank-account-number' => '0532013000'
            }).
            to_return(:status => 200, :body => json_response)
        end

        it 'should return error code' do
          expect(subject[:return_code]).to eq('10')
        end
      end
    end

    context 'Webservice not found' do
      before :each do
        stub_request(:get, Ibanomat::URL).
          with(:query => {
            'bank-code'           => '37040044',
{'fraction_non_alphanumeric': 0.11575714623198677, 'fraction_numerical': 0.07181667847862036, 'mean_word_length': 1.3574610244988865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7349134', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1201, 'n_words': 268}