Reputation: 11882
I'm familiar with the Rspec's before
blocks.
For example,
before(:each) do
# some setup code before each test
end
and
before(:all) do
# some setup code before all the tests
end
But I have seen
before do
# some code
end
How is this before
without any parameter different from before(:each)
and before(:all)
? If it's different, when is it executed?
Thank you.
Upvotes: 5
Views: 490
Reputation: 4517
before do
# some code
end
Is simply shorthand for
before(:each) do
# some code
end
Upvotes: 7