Skip to content

Instantly share code, notes, and snippets.

@enkessler
Last active October 18, 2017 22:58
Show Gist options
  • Save enkessler/5c82fb0f1d425acd4ec32efb6ae03f59 to your computer and use it in GitHub Desktop.
Save enkessler/5c82fb0f1d425acd4ec32efb6ae03f59 to your computer and use it in GitHub Desktop.
Data table corruption example
When(/^whatever we have too much of in the back room:$/) do |table|
$stdout.puts "starting table:\n#{table}"
$stdout.puts "id: #{table.rows_hash.object_id}"
@todays_sauce = ['ketchup', 'mustard', 'vinegar', 'mayo', 'lard'].sample
table.rows_hash['recipe'].sub!('<sauce of the day>', @todays_sauce)
@recipe = table.rows_hash['recipe']
$stdout.puts "ending table:\n#{table}"
end
Then(/^inform the masses$/) do
$stdout.puts "Today's secret sauce is: #{@recipe}!"
expect(@recipe).to eq("3 squirts of #{@todays_sauce}")
end
Feature: Our recipe
Background:
* whatever we have too much of in the back room:
| recipe | 3 squirts of <sauce of the day> |
Scenario: Monday
Then inform the masses
Scenario: Tuesday
Then inform the masses
Scenario: Wednesday
Then inform the masses
Scenario: Thursday
Then inform the masses
Scenario: Friday
Then inform the masses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment