> let! adds a before hook and before hooks get run in the order they're
> declared, so just declare them in the other order:
> 
> let!(:yo_momma) { create_yo_momma }
> config.before(:each) do
>   ActionMailer::base.deliveries.clear
> end

Hmm.. The way that I usually work is that my "lets" are specific to a
spec...

# some_spec.rb

let!(:xyz) { "XYZ" }

# some_other_spec.rb

let!(:foo) { "foobar!" }

...

So, my goal is to not have to clutter my actual spec files with things
like ActionMailer::Base.deliveries.clear ...  That's something that I
want to always assure is blank at the beginning of an example regardless
of the what spec file I am running.

I was hoping there was some way to change the order of hook execution,
and make the stuff in spec_helper happen last...


Patrick J. Collins
http://collinatorstudios.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to