Hello all,
Does anyone know if it is possible to nest specs such that they call before_each
only once for the nested describe
block? The docs around testing seem a bit incomplete.
What I would like is:
describe "Page Tests" do
before_each {
puts "Set up some test data..."
}
describe "CREATE, READ, UPDATE, DELETE" do
before_each {
puts "START TRANSACTION..."
}
after_each {
puts "ROLLBACK TRANSACTION!"
}
it "one" do
true.should be_truthy
end
it "two" do
true.should be_truthy
end
it "three" do
true.should be_truthy
end
end
end
To set up the test data only once… but instead I get:
Set up some test data...
START TRANSACTION...
.ROLLBACK TRANSACTION!
Set up some test data...
START TRANSACTION...
.ROLLBACK TRANSACTION!
Set up some test data...
START TRANSACTION...
.ROLLBACK TRANSACTION!