On 2 Dec 2008, at 15:26, Joseph Wilk wrote:

BeforeAll (Before running any feature) is currently possible through putting something in your env.rb or really any ruby file that gets required. It will be run once (and before anything else). I use this to manage ferret/selenium. The before/afters being used to tell the service to cleanup so we have clean environment for each test. Could you do the same?

And Afterall is possible through: at_exit

Yeah, I've had to resort to doing this, which makes the end of my env.rb look like this:

  #######################
  # Start everything up #
  #######################

  require 'support/service_controllers'

  # Note this relies on this file being loaded only once!

  ServiceControllers.stop_all
  ServiceControllers.start_all

  at_exit do
    ServiceControllers.stop_all
  end

I don't like this though, it's asymmetric.


BeforeFeature sounds like it could be useful for preparing services for that specific feature and you don't want them running for other features. I guess currently the only way of achieving this is separating those features and running them in separate cucumber runs. This is what I have done with something similar, using -- profile to run different sets of features. I prefer this (in my experience so far) as it allows me to re-use my rake tasks for setting things up and keeps that setup from adding noise to my test code. I appreciate with mock services your situation is slightly different.

I see what you mean, but it's always useful to run all the features in one run. 'rake features' should be the unambiguous, authoritative decider of whether your code can go live (IMHO).

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/



_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to