Sha256: b4b39a282b71bb99b4bb32d02842f0c4b5632dca8ea6534b3e3cc1f1151f527f

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

class TestServiceWithWsdl
  include SoapObject

  wsdl 'http://www.webservicex.net/airport.asmx?WSDL'
  log_level :error

  def get_airport_name_for(airport_code)
    response = get_airport_information_by_airport_code airport_code: airport_code
    doc = Nokogiri::XML(response)
    doc.xpath('//Table/CityOrAirportName').first.content
  end
end

class TestServiceWithLocalWsdl
  include SoapObject

  wsdl "#{File.dirname(__FILE__)}/../wsdl/airport.asmx.wsdl"
end



Given /^I have the url for a remote wsdl$/ do
  @cls = TestServiceWithWsdl
end

Given /^I have a wsdl file residing locally$/ do
  @cls = TestServiceWithLocalWsdl
end

When /^I create an instance of the SoapObject class$/ do
  @so = @cls.new
end

Then /^I should have a connection$/ do
  @so.should be_connected
end

Then /^I should be able to determine the operations$/ do
  @so.operations.should include :get_airport_information_by_airport_code
end

Then /^I should be able to make a call and receive the correct results$/ do
  @so.get_airport_name_for('SFO').should == 'SAN FRANCISCO INTL'
end

Then /^the results body should contain "(.*?)"$/ do |body|
  @so.body.should include body
end

Then /^the results body xml should be a Nokogiri XML object$/ do
  @so.body_xml.should be_instance_of Nokogiri::XML::Document
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soap-object-0.4 features/step_definitions/basic_functionality_steps.rb