Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Add #passed? and #failed? methods to ExampleGroup #401

@natritmeyer

Description

@natritmeyer

I often want to diagnostic stuff in the after(:each) block of a failing test, but there is no way to determine the outcome of a test. As described here: https://github.com/cucumber/cucumber/wiki/Hooks, cucumber has the following construct:

After do |scenario|
  if scenario.failed?
    #do stuff
  end
end

I have put together a monkey patch which lets me do that in rspec. The gist is here:

https://gist.github.com/1009181

It provides #passed? and #failed? methods on RSpec::Core::ExampleGroup

after(:each) do
  if failed?
    #do stuff
  end
end

It would be great if rspec provided something like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions