I don't if this is a bug or feature but if before(:all) create some
persistent objects, these changes doesn't rollback when we get out of the
context.
Here are simplest example to see the issue:

 describe Person do
  context "1" do
    before(:all) do
      Person.create!(@valid_attributes)
    end
    it {
      Person.count.should == 1
    }
  end

  context "2" do
    before(:all) do
      Person.create!(@valid_attributes)
    end
    it {
      Person.count.should == 1
    }
  end
end

One of these two examples always fail because the object created in
before(:all) block of other example won't be clean up.

If it is not a bug then can someone explain why does it work in this way?
My thoughts is that changes made by before(:all) should be rollback after we
get out of scope.
In the same way as before(:each) do.



-- 
Bogdan Gusiev.
agre...@gmail.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to