[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
Sun Nov 18 20:58:04 EST 2007


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

Category: None
Group: None
>Status: Closed
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: Chad Humphries (spicycode)
Date: 2007-11-19 01:57

Message:
Moved to http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/27-6651-ability-to-query-whether-a-spec-has-failed-or-not-in-teardown#ticket-27-2

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-31 12:32

Message:
It's not doc'd on the website because it's not really an RSpec feature. It's a library that we've forked into RSpec in order to avoid the dependency.

There is rdoc in the callback dirs - check it out and see if you find it sufficient or not.

That said, Brian, can you please enlighten us as to how to use the before_setup and after_teardown callbacks to solve Aslak's seemingly-former-problem.

Thanks,
David

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

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-01-31 10: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-31 00: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