The before method accepts a scope parameter, which defaults to :each . When you leave this, it means what you mean :each , so your two examples do the same.
Here is a useful tidbit from RSpec RDoc, Module: RSpec :: Core :: Hooks # to :
Options:
- scope (Symbol) -
:each :all or :suite (default :each ) - (Hash) - restricts this hook to examples matching these conditions, for example.
before(:each, :ui => true) { ... } will only work with examples or groups declared with :ui => true .
source share