Sha256: 97698ac921f46ab9bcf310cd1bcdc3510c1d123a8222d79782d9b0ff195a5719

Contents?: true

Size: 1.54 KB

Versions: 17

Compression:

Stored size: 1.54 KB

Contents

# Use this to fill in an entire form with data from a table. Example:
#
# Then fields are filled with:
# | Account Number       | 5002       |
# | Expiry date          | 2009-11-01 |
# | Note                 | Nice guy   |
# | Wants Email?         | true       |
# | Sex                  | Male       |
# | Accept user agrement | true       |
# | Send me letters      | false      |
# | radio 1              | true       |
# | Avatar               | avatar.png |
# | Due date             | 12:35      |
Then(/^fields are filled with:( within (?:.*))?$/,
     &Pickles::StepDef.define_table_step([2, 3]) do |label, value, within|

  CheckIn::Factory.new(label, value, within: within).call.call

end)

# do |within, fields|
#
#   Waiter.wait_for_ajax
#
#   if fields.headers.length == 3
#     current_within = within
#
#     rows = fields.rows.unshift(fields.headers)
#
#     rows.each do |(within, label, value)|
#       case within
#       when /\A(.+?)(?: "(.*)")?\Z/
#         current_within = Pickles.detect_node($1, $2, within)
#       when "-"
#         current_within = within
#       end
#
#       if label['pry']
#         label['pry'] = ''
#
#         pry binding
#       end
#
#       CheckIn::Factory.new(label, value, within: current_within).call.call
#     end
#   elsif fields.headers.length == 2
#     fields.rows_hash.each do |label, value|
#       pry binding if label['pry']
#       CheckIn::Factory.new(label, value, within: within).call.call
#     end
#   else
#     raise(ArgumentError, 'Unsupported table type. Must contain 2 or 3 columns')
#   end
#
# end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pickles-0.2.4 lib/cucumber/pickles/steps/check.rb
pickles-0.2.3 lib/cucumber/pickles/steps/check.rb
pickles-0.2.2 lib/cucumber/pickles/steps/check.rb
pickles-0.2.1 lib/cucumber/pickles/steps/check.rb
pickles-0.2.0 lib/cucumber/pickles/steps/check.rb
pickles-0.1.12 lib/cucumber/pickles/steps/check.rb
pickles-0.1.10 lib/cucumber/pickles/steps/check.rb
pickles-0.1.9 lib/cucumber/pickles/steps/check.rb
pickles-0.1.8 lib/cucumber/pickles/steps/check.rb
pickles-0.1.7 lib/cucumber/pickles/steps/check.rb
pickles-0.1.6 lib/cucumber/pickles/steps/check.rb
pickles-0.1.5 lib/cucumber/pickles/steps/check.rb
pickles-0.1.4 lib/cucumber/pickles/steps/check.rb
pickles-0.1.3 lib/cucumber/pickles/steps/check.rb
pickles-0.1.2 lib/cucumber/pickles/steps/check.rb
pickles-0.1.1 lib/cucumber/pickles/steps/check.rb
pickles-0.1.0 lib/cucumber/pickles/steps/check.rb