These are chat archives for cucumber/cucumber-ruby

Sep 2017
Sep 27 2017 21:08

Longtime Cucumber user and Ruby enthusiast.
On a serious note, I'm struggling with when I should delete data and where I can (e.g. After hook)?

Scenario: As John I verify I feel good once I put on shoes
Given: I create a person named John
When:  I put my shoes on
Then: I feel refreshed
And: I delete person named John using an API call

In this scenario I am setting up my person named John from the UI, however, I don't want this person hanging around in my DB, so I'm adding a step to delete this individual. The scenario is not about deleting John, but feeling good about putting on shoes. So, if for some reason my deletion fails, then the test fails which is incorrect. So, can I abstract this step and place it into an After hook using a variable that I store John in? What if I have multiple scenarios creating multiple Johns, can I still abstract this step?

I know this might sound jumbled, so please tell me to provide further or clearer details.