ruby on rails - before(:each) vs just before -
i new ruby on rails. , playing around testing
is there difference between
before(:each) #some test code end
and
before #some test code end
the before
method accepts scope
parameter defaults :each
. when leave out, it's implied mean :each
, 2 examples exact same thing.
here helpful tidbit rspec rdoc, module: rspec::core::hooks#before:
parameters:
- scope (symbol) —
:each
,:all
, or:suite
(defaults:each
)- conditions (hash) — constrains hook examples matching these conditions e.g.
before(:each, :ui => true) { ... }
run examples or groups declared:ui => true
.
Comments
Post a Comment