Sha256: fc59e00be0ff72ace9cf491f127956d60c6d0e5060186cae0029961c2f94019c

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

within_reg = /\A\s*(.*)?\s*(?:["|'](.*?)["|'])?\s*\Z/

transformation = -> (within_info) do
  splitted = within_info.split('within').reject(&:blank?)


  splitted.reverse_each.inject(page) do |within, info|
    captures = Helpers::Regex::WITHIN.match(info).captures
    el_alias = captures[0]
    locator = captures[1]

    Waiter.wait do
      within = Pickles.detect_node(el_alias, locator, within: within)
    end

    within
  end
end

transform_regex = /(within .*)$/

begin
  Transform(transform_regex, &transformation)
rescue NoMethodError => err
  ParameterType(
    name: 'within',
    regexp: transform_regex,
    transformer: transformation
  )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pickles-0.1.12 lib/cucumber/pickles/transform.rb