lib/testable/extensions/data_setter.rb
# The `using` method tells Testable to match up whatever data is passed
# in via the action with element definitions. If those elements are found,
# they will be populated with the specified data. Consider the following:
#
#    class WarpTravel
#      include Testable
#
#      text_field :warp_factor, id: 'warpInput'
#      text_field :velocity,    id: 'velocityInput'
#      text_field :distance,    id: 'distInput'
#    end
#
# Assuming an instance of this class called `page`, you could do the
# following:
#
#    page.using_data(warp_factor: 1, velocity: 1, distance: 4.3)
#
# This is based on conventions. The idea is that element definitions are
# written in the form of "snake case" -- meaning, underscores between
# each separate word. In the above example, "warp_factor: 1" would be
# matched to the `warp_factor` element and the value used for that
# element would be "1". The default operation for a text field is to
# enter the value in. It is also possible to use strings:
#
#    page.using_data("warp factor": 1, velocity: 1, distance: 4.3)
#
# Here "warp factor" would be converted to "warp_factor".
The `using` method tells Testable to match up whatever data is passed
in via the action with element definitions. If those elements are found,
they will be populated with the specified data. Consider the following.

class WarpTravel
include Testable



Assuming an instance of this class called `page`, you could do the
following.



This is based on conventions. The idea is that element definitions are
written in the form of "snake case" -- meaning, underscores between
each separate word. In the above example, "warp_factor: 1" would be
matched to the `warp_factor` element and the value used for that
element would be "1". The default operation for a text field is to
enter the value in. It is also possible to use strings.



Here "warp factor" would be converted to "warp_factor".
The ` using ` method tells Testable to match up whatever data is passed in via the action with element definitions . If those elements are found they will be populated with the specified data . Consider the following . class WarpTravel include Testable Assuming an instance of this class called ` page ` you could do the following . This is based on conventions . The idea is that element definitions are written in the form of " snake case " -- meaning underscores between each separate word . In the above example " warp_factor : 1 " would be matched to the ` warp_factor ` element and the value used for that element would be " 1 " . The default operation for a text field is to enter the value in . It is also possible to use strings . Here " warp factor " would be converted to " warp_factor " .
def using(data)
      data.each do |key, value|
        use_data_with(key, value.to_s) if object_enabled_for(key)
      end
    end
def using ( data ) data . each do | key , value | use_data_with ( key , value . to_s ) if object_enabled_for ( key ) end end
The `using` method tells Testable to match up whatever data is passed
in via the action with element definitions.
The ` using ` method tells Testable to match up whatever data is passed in via the action with element definitions .
data
<not_specific>