diff --git a/spec/integration/zipcode_example_spec.rb b/spec/integration/zipcode_example_spec.rb index cedeca04..b434fa45 100644 --- a/spec/integration/zipcode_example_spec.rb +++ b/spec/integration/zipcode_example_spec.rb @@ -2,26 +2,26 @@ require "spec_helper" RSpec.describe "ZIP code example" do - it "supports threads making requests simultaneously" do - client = Savon.client( - :wsdl => "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl", + let(:expected) { ["seventy million seventy thousand ten ", "twenty four million fifty thousand one hundred and ten ", "twenty million fifty thousand five hundred and fifty "] } + let(:request_data) { [70070010, 24050110, 20050550] } + let(:client) { + Savon.client( + wsdl: "https://www.dataaccess.com/webservicesserver/NumberConversion.wso?wsdl", + ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, # Lower timeouts so these specs don't take forever when the service is not available. - :open_timeout => 10, - :read_timeout => 10, - - :log => false # Disable logging for cleaner spec output. + open_timeout: 10, + read_timeout: 10, + log: false # Disable logging for cleaner spec output. ) - - mutex = Mutex.new - - request_data = [70070010, 24050110, 20050550] + } + let(:mutex) { Mutex.new } + it "supports threads making requests simultaneously" do threads_waiting = request_data.size - threads = request_data.map do |blz| thread = Thread.new do - response = call_and_fail_gracefully(client, :get_bank, :message => { :blz => blz }) - Thread.current[:value] = response.body[:get_bank_response][:details] + response = call_and_fail_gracefully(client, :number_to_words, :message => { :ubi_num => blz }) + Thread.current[:value] = response.body[:number_to_words_response][:number_to_words_result] mutex.synchronize { threads_waiting -= 1 } end @@ -34,6 +34,6 @@ threads.each(&:kill) values = threads.map { |thr| thr[:value] }.compact - expect(values.uniq.size).to eq(values.size) + expect(values).to match_array(expected) end end