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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -