lib/kelp/field.rb
# Verify the values of multiple fields given as a Hash.
#
# @param [Hash] field_values
#   "field" => "value" for each field you want to verify
# @param [Hash] scope
#   Scoping keywords as understood by {#in_scope}
#
# @raise [Kelp::Unexpected]
#   If any field does not contain the expected value
#
Verify the values of multiple fields given as a Hash.
Verify the values of multiple fields given as a Hash .
def fields_should_contain(field_values, scope={})
      in_scope(scope) do
        field_values.each do |field, value|
          _field = find_field(field)
          if value.nil? or value.strip.empty?
            field_should_be_empty(field)
          elsif _field.tag_name == 'select'
            dropdown_should_equal(field, value)
          else
            field_should_contain(field, value)
          end
        end
      end
    end
def fields_should_contain ( field_values , scope = { } ) in_scope ( scope ) do field_values . each do | field , value | _field = find_field ( field ) if value . nil? or value . strip . empty? field_should_be_empty ( field ) elsif _field . tag_name == 'select' dropdown_should_equal ( field , value ) else field_should_contain ( field , value ) end end end end
Verify the values of multiple fields given as a Hash.
Verify the values of multiple fields given as a Hash .
# For nil/empty, check for nil field or nil value # If field is a dropdown # Otherwise treat as a text field
[Kelp::Unexpected] If any field does not contain the expected value
[ Kelp :: Unexpected ] If any field does not contain the expected value
field_values
<not_specific>
scope
<not_specific>
<not_specific>
scope Scoping keywords as understood by {#in_scope}
scope Scoping keywords as understood by { #in_scope }