lib/soaspec/accessors.rb in soaspec-0.0.36 vs lib/soaspec/accessors.rb in soaspec-0.0.37
- old
+ new
@@ -4,10 +4,23 @@
module Accessors
# Defines expected_mandatory_elements method used in 'success_scenario' shared examples
# to indicate certain elements must be present
# @param [Array] elements Array of symbols specifying expected element names for 'success scenario' in snakecase
+ #
+ # @example Inside class
+ # mandatory_elements :GetWeatherResult
+ #
+ # Or for a list
+ #
+ # @example Inside class
+ # mandatory_elements [:GetWeatherResult, :GetResultStatus]
+ #
+ # In test
+ # describe Exchange(:name) do
+ # it_behaves_like 'success scenario' # Includes checks for mandatory elements
+ # end
def mandatory_elements(elements)
define_method('expected_mandatory_elements') do
return [elements] if elements.is_a?(String) || elements.is_a?(Symbol)
elements
end
@@ -39,10 +52,10 @@
# describe Exchange(:name) do
# it_behaves_like 'success scenario' # Includes json pair validation
# end
#
def mandatory_json_values(json_value_pairs)
- raise ArgumentError('Hash of {jsonpath => expected values} expected ') unless json_value_pairs.is_a? Hash
+ raise ArgumentError("Hash of {'jsonpath' => expected values} expected") unless json_value_pairs.is_a? Hash
define_method('expected_mandatory_json_values') do
json_value_pairs
end
end
\ No newline at end of file