lib/soaspec.rb in soaspec-0.0.81 vs lib/soaspec.rb in soaspec-0.0.82

- old
+ new

@@ -1,85 +1,86 @@ -require 'rest-client' # REST -require 'erb' # Embedded ruby -require 'yaml' # Reading yaml -require 'rspec' # Testing framework -require 'rspec/its' -require 'savon' # SOAP -require 'nokogiri' # XPath -require 'date' -require 'jsonpath' - -require 'soaspec/version' -require 'soaspec/exchange_handlers/soap_handler' -require 'soaspec/exchange_handlers/exchange_handler' -require 'soaspec/exchange_handlers/rest_methods' -require 'soaspec/exchange' -require 'soaspec/matchers' -require 'soaspec/soaspec_shared_examples' -require 'soaspec/core_ext/hash' -require 'soaspec/spec_logger' -require 'soaspec/exe_helpers' -require 'soaspec/exchange_handlers/rest_handler' -require 'soaspec/exchange_handlers/handler_accessors' -require 'soaspec/interpreter' -require 'soaspec/not_found_errors' -require 'soaspec/test_server/get_bank' -require 'soaspec/test_server/test_attribute' -require 'soaspec/test_server/puppy_service' -require 'soaspec/test_server/invoices' -require 'soaspec/wsdl_generator' - -# Gem for handling SOAP and REST api tests -module Soaspec - - class << self - - # Folder used to store credentials - # Used in auth2_file command - # @param [String] folder - def credentials_folder=(folder) - @credentials_folder = folder - end - - # Credentials folder used to store secret data (not in source control) E.g passwords - def credentials_folder - @credentials_folder - end - - # Used so that exchange class knows what context it's in - # @param [ExchangeHandler] handler A class inheriting from Soaspec::ExchangeHandler. Exchange class uses this - def api_handler=(handler) - @api_handler = handler - end - - # Exchange Handler class currently being used - def api_handler - @api_handler - end - - # Set whether to transform strings to keys in request automatically - # @param [Boolean] use_keys - def always_use_keys=(use_keys) - @always_use_keys = use_keys - end - - # @return [Boolean] Whether to transform strings to keys in request automatically - def always_use_keys? - @always_use_keys || true - end - - # Whether to remove namespaces from response in Xpath assertion automatically - # For why this may not be a good thing in general see - # http://tenderlovemaking.com/2009/04/23/namespaces-in-xml.html - # This will be overridden if xpath has a ':' in it - def strip_namespaces=(remove_namespaces) - @strip_namespaces = remove_namespaces - end - - # Whether to remove namespaces in xpath assertion automatically - def strip_namespaces? - @strip_namespaces || false - end - end -end - -RestClient.log = Soaspec::SpecLogger.create +require 'rest-client' # REST +require 'erb' # Embedded ruby +require 'yaml' # Reading yaml +require 'rspec' # Testing framework +require 'rspec/its' +require 'savon' # SOAP +require 'nokogiri' # XPath +require 'date' +require 'jsonpath' + +require 'soaspec/version' +require 'soaspec/exchange_handlers/soap_handler' +require 'soaspec/exchange_handlers/exchange_handler' +require 'soaspec/exchange_handlers/rest_methods' +require 'soaspec/exchange' +require 'soaspec/matchers' +require 'soaspec/soaspec_shared_examples' +require 'soaspec/core_ext/hash' +require 'soaspec/spec_logger' +require 'soaspec/exe_helpers' +require 'soaspec/exchange_handlers/rest_handler' +require 'soaspec/exchange_handlers/handler_accessors' +require 'soaspec/interpreter' +require 'soaspec/not_found_errors' +require 'soaspec/test_server/get_bank' +require 'soaspec/test_server/test_attribute' +require 'soaspec/test_server/puppy_service' +require 'soaspec/test_server/invoices' +require 'soaspec/test_server/test_namespace' +require 'soaspec/wsdl_generator' + +# Gem for handling SOAP and REST api tests +module Soaspec + + class << self + + # Folder used to store credentials + # Used in auth2_file command + # @param [String] folder + def credentials_folder=(folder) + @credentials_folder = folder + end + + # Credentials folder used to store secret data (not in source control) E.g passwords + def credentials_folder + @credentials_folder + end + + # Used so that exchange class knows what context it's in + # @param [ExchangeHandler] handler A class inheriting from Soaspec::ExchangeHandler. Exchange class uses this + def api_handler=(handler) + @api_handler = handler + end + + # Exchange Handler class currently being used + def api_handler + @api_handler + end + + # Set whether to transform strings to keys in request automatically + # @param [Boolean] use_keys + def always_use_keys=(use_keys) + @always_use_keys = use_keys + end + + # @return [Boolean] Whether to transform strings to keys in request automatically + def always_use_keys? + @always_use_keys || true + end + + # Whether to remove namespaces from response in Xpath assertion automatically + # For why this may not be a good thing in general see + # http://tenderlovemaking.com/2009/04/23/namespaces-in-xml.html + # This will be overridden if xpath has a ':' in it + def strip_namespaces=(remove_namespaces) + @strip_namespaces = remove_namespaces + end + + # Whether to remove namespaces in xpath assertion automatically + def strip_namespaces? + @strip_namespaces || false + end + end +end + +RestClient.log = Soaspec::SpecLogger.create