Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a missing Cucumber scenario #2695

Closed

Conversation

skalee
Copy link
Contributor

@skalee skalee commented Feb 4, 2020

after blocks are run no matter if given example has succeeded or not. This is normal behaviour, and this very commit adds a respective Cucumber scenario.

Fixes #2692.

Feel free to reword the commit or added scenario if needed.

`after` blocks are run no matter if given example has succeeded or not.
This is normal behaviour, and this very commit adds a respective
Cucumber scenario.

Fixes rspec#2692.
end

example "deliberate failure" do
expect(true).to be(false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty obvious that after hooks are being run for failed examples.

I believe the original issue had in mind an example that raises an exception:

  it do
    raise "in example"
  end

Do you mind to change this feature to reflect that scenario?

For completeness, it would be nice to have scenarios when the example is pending or skipped.

Copy link
Member

@JonRowe JonRowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tweak to the title as there aren't the states you describe, this is just demonstrating the independence of hooks

@@ -300,6 +300,31 @@ Feature: `before` and `after` hooks
after suite
"""

Scenario: `after` blocks are run also for examples which have failed or encountered other errors
Copy link
Member

@JonRowe JonRowe Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Scenario: `after` blocks are run also for examples which have failed or encountered other errors
Scenario: `after` blocks are run regardless of the result of the example

@JonRowe
Copy link
Member

JonRowe commented Apr 4, 2020

Thank you very much for getting this started @skalee, closing in favour of #2715

@JonRowe JonRowe closed this Apr 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation needed that #after hooks are executed for pending/skipped/failed specs
3 participants