Cucumber's table diffing does not play nice with Spreewald's `patiently do`

Updated . Posted . Visible to the public.

Turns out, Cucumber::MultilineArgument::DataTable#diff! caches some stuff. Code of the following form will not work as intended:

Then('some table should look like') do |expected_table|
  patiently do
    actual_table = calculate_actual_table
    expected_table.diff!(actual_table) # not actually patient, will keep failing if it failed the first time
  end
end

Instead, simply use

expected_table.dup.diff!(actual_table)
Tobias Kraze
Last edit
Michael Leimst├Ądtner
Keywords
dup, diff
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2020-04-15 14:59)