lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.2.8 vs lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.2.9

- old
+ new

@@ -1,10 +1,8 @@ - require_relative 'handler_accessors' module Soaspec - # Inherit this for a class describing how to implement a particular exchange. # Has basic methods common for methods defining RSpec tests in YAML class ExchangeHandler extend Soaspec::HandlerAccessors @@ -17,14 +15,15 @@ end # Set instance variable name # @param [String, Symbol] name Name used when describing API test # @param [Hash] options Parameters defining handler. Used in descendants - def initialize(name = self.class.to_s, options = {}) + def initialize(name = self.class.to_s, _options = {}) use @request_option = :hash raise ArgumentError, 'Cannot define both template_name and default_hash' if respond_to?(:template_name_value) && respond_to?(:default_hash_value) + @template_name = respond_to?(:template_name_value) ? template_name_value : '' @default_hash = respond_to?(:default_hash_value) ? default_hash_value : {} @name = name end @@ -100,10 +99,11 @@ end # Set instance variable and remove it from Hash def set_remove_key(hash, key) return unless hash.key? key + __send__("#{key}=", hash[key]) hash.delete key end # @return [Boolean] Whether to remove namespaces in xpath assertion automatically @@ -112,9 +112,10 @@ end # Request of API call. Either intended request or actual request def request(response) return "Request not yet sent Request option is #{@request_option}" unless response + 'Specific API handler should implement this' end end -end \ No newline at end of file +end