lib/spreewald/table_steps.rb in spreewald-0.5.10 vs lib/spreewald/table_steps.rb in spreewald-0.5.11
- old
+ new
@@ -44,10 +44,11 @@
@last_unmatched_row = nil
@extra_rows = nil
@best_rows_matched = -1
options = args.extract_options!
expected_table = args.first
+ skipped_rows = []
tables.any? do |table|
rows_matched = 0
match = expected_table.all? do |expected_row|
if @best_rows_matched < rows_matched
@last_unmatched_row = expected_row
@@ -60,16 +61,18 @@
else
rows_matched += 1
if options[:unordered]
table.delete_at(first_row)
else
+ skipped_rows += table[0...first_row]
table = table[(first_row + 1)..-1]
end
true
end
end
- if match and options[:exactly] and not table.empty?
- @extra_rows = table
+ remaining_rows = skipped_rows + table
+ if match and options[:exactly] and not remaining_rows.empty?
+ @extra_rows = remaining_rows
match = false
end
match
end
end