The opinions expressed herein are my own personal opinions and do not represent
my employer's view in anyway.
© Copyright 2015, Eleutian Technology
Mikel Lindsaar recently posted a tip encouraging rSpec users to not use before :each, and set up the context in every "it" specification.
I'm afraid I disagree. By pushing context setup into your specifications, you're allowing your contexts to become artificial and anemic and your specifications to become fat and more than just specifications. Ultimately, this means that your reports will read poorly and it will be easy to introduce specifications in a context that do not match the others.Mikel arrives at the following specs at the end of his post:
describe "when not logged in" do
it "should redirect if we are not logged in" do
response.should redirect_to login_path
describe "when logged in" do
session[:logged_in] = true
session[:user_id] = 99
it "should let be a success" do
it "should render the index template" do
© 2007 Eleutian Technology