Detect Rspec test failure on after each method

前端 未结 3 1801
既然无缘
既然无缘 2021-01-01 12:44

I am trying to run an RSpec test, and I want to detect if the test failed in the after method. I have something like this right now:

after(:each         


        
3条回答
  •  一个人的身影
    2021-01-01 13:28

    In addition to Daniel's answer, in Rspec3 the example method was deleted (see here for more info).

    You will have to do something like this:

    after(:each) do |example|
      if example.exception
        # ...
      end
    end
    

提交回复
热议问题