RSpec hooks

Before and After hooks are of great use to execute common set of code before and after a test suite, test case.


Ex 1 -

before {@user = ‘John’, email: ‘’)}

Ex 2 -

before(:each) do

@user =


Ex 3 -

before(:all) do

puts ‘check user’


Like what you read? Give Build to explore a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.