> Proper usage, sure, but the memoization is only within each example - not
> across examples. That way you can do this:

So regarding objects persisting over multiple examples--  I was told repeatedly
by experienced RSpec peeps to not use before(:all)...

But in a case like:

before(:each) do
  @user = create_user
  create_user_item(:user => @user)
end

it "has an item" do
  @user.user_item.should_not be_nil
end

it "rocks the house" do
  @user.user_item.should respond_to(:rocks_the_house)
end

..etc...

It seems like this is an instance where before :all, really would shine because
it would not require records to be repeatedly created...

Do you guys feel like before(:all) is just bad because of the possibility of a
method call in one example changing the state and therefore breaking future
examples and not having it be clear as to why.. ?



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