[rspec-users] cucumber hooks BeforeAll and AfterAll
Joaquin Rivera Padron
joahking at gmail.com
Mon Feb 16 03:57:38 EST 2009
2009/2/15 Ben Mabey <ben at benmabey.com>
> Zach Dennis wrote:
>> On Sun, Feb 15, 2009 at 2:21 PM, Joaquin Rivera Padron
>> <joahking at gmail.com> wrote:
>>> hey there,
>>> the short version:
>>> right now Cucumber provides hooks Before and After to be run around every
>>> step, I have notice some use case where BeforeAll and AfterAll hooks
>>> be useful.
>>> are ther plans that they be provided? what you think would be the best
>>> to do it (mother_step.rb)? any ideas about this could be accomplished?
>> BeforeAll is equivalent to just calling code up in env.rb.
>> AfterAll is equivalent to registering a ruby at_exit hook in your env.rb.
>> Of course they don't have to go in your env.rb, you could put them in
>> another file, and then require them from env.rb or just let cucumber
>> auto-load them if they're in your support/ directory.
> To illustrate what Zach is saying here is an example I used on the wiki
> # Global setup
> ActionMailer::Base.delivery_method = :test
> ActionMailer::Base.perform_deliveries = true
> Before do
> # Scenario setup
> After do
> # Scenario teardown
> at_exit do
> # Global teardown
>>> the long version:
>>> playing with culerity, which according to the author:
>>> * when running cucumber culerity spawns a new jruby process (that's the
>>> IO.popen call) - this way cucumber runs in plain old ruby (and you can
>>> with your models for test setup etc.) and only celerity runs in jruby
>>> * from then on all communication has to go through pipes (in, out) so i
>>> passing the browser config through those pipes to the newsly spawned
>>> * when a test fails the jruby process doesn't get killed, that's the java
>>> processes you see. don't have a good idea how to solve this yet. for now
>>> will have to kill those processes by hand.
>>> that has improved since now there's a first attempt for built in support
>>> kill orfan java processes at:
>>> culerity trick happen at step_definitions/common_celerity.rb Before and
>>> After hooks, where you build and kill a spawned jruby around every step.
>>> There it is easy to see the gain if we could do those in an around All
>>> what do you think?
>>> rspec-users mailing list
>>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users