lib/cucumber/pickles/transform.rb in pickles-0.1.10 vs lib/cucumber/pickles/transform.rb in pickles-0.1.12
- old
+ new
@@ -1,8 +1,8 @@
within_reg = /\A\s*(.*)?\s*(?:["|'](.*?)["|'])?\s*\Z/
-Transform(/(within .*)$/) do |within_info|
+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
@@ -13,6 +13,18 @@
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