Read more

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

Tobias Kraze
April 15, 2020Software engineer at makandra GmbH

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
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Instead, simply use

expected_table.dup.diff!(actual_table)
Posted by Tobias Kraze to makandra dev (2020-04-15 16:59)