I want to extract the method for logging in so that I don&#39;t have to include it in each before call.<br><br>Is it bad to use a describe block within the rspec_helper in a rails project for controller tests?<br><br>I have in my spec_helper.rb
<br><br>describe &quot;an authenticated request&quot;, :shared =&gt; true do<br>&nbsp; before( :each ) do<br>&nbsp;&nbsp;&nbsp; @u = mock_model( User )<br>&nbsp;&nbsp;&nbsp; mock_login( @u )<br>&nbsp; end<br><br>&nbsp; def mock_login( user )<br>&nbsp;&nbsp;&nbsp; session[:user] = user
<br>&nbsp;&nbsp;&nbsp; controller.send( :instance_variable_set, :@current_user, user )<br>&nbsp;&nbsp;&nbsp; controller.stub!( :current_user ).and_return( user )<br>&nbsp; end<br><br>end<br><br><br>which I then share in my relevant controller tests with<br>
<br>&nbsp; it_should_behave_like &quot;an authenticated request&quot;<br><br>Is this bad?&nbsp; <br><br>