Posted 9 months ago. Visible to the public. Repeats.

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

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

Copy
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

Copy
expected_table.dup.diff!(actual_table)

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Tobias Kraze
Last edit:
6 months ago
by Daniel Straßner
Keywords:
dup, diff
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more