[rspec-devel] [ rspec-Feature Requests-6651 ] Ability to query whether a spec has failed or not in teardown

noreply at rubyforge.org noreply at rubyforge.org
Wed Jan 31 05:18:18 EST 2007


Feature Requests item #6651, was opened at 2006-11-13 13:39
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6651&group_id=797

Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Aslak Hellesøy (aslak_hellesoy)
Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: Ability to query whether a spec has failed or not in teardown

Initial Comment:
I'm using RSpec to drive Watir. When a spec fails, I want to take a screenshot before closing the browser in teardown. (Screenshotting is supported by Watir). Example:

teardown do
  if failed?
    screenshot_file_name = "#{context_name} #{spec_name}.jpg".gsub!(/\s/, "_")
    screen_capture(screenshot, true)
  end
  @ie.close
end

3 new methods that need to be available in teardown:

failed?
context_name
spec_name


----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-01-31 05:18

Message:
I never got it resolved because I couldn't easily figure out how to use the callback stuff (no docs).

Further, I realised I didn't really need it. I thought I needed it in spec/ui to decide whether or not to take a screenshot (for failing specs), but realized I can always take a screenshot in teardown, regardless of whether the spec failed.

Therefore, I'm not sure we need the callback stuff at all in RSpec - it doesn't seem to solve any real problems - at least not that I'm aware of. As far as I am concerned it is a non-feature because it's not documented.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-30 19:05

Message:
Aslak - did this one got resolved w/ the addition of callbacks? If so, can we kill it?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6651&group_id=797


More information about the rspec-devel mailing list