Dê uma olhada em rspec-action gem.
Compare 1 e 2:
1
describe "GET index" do
context 'if user signed in' do
before { sign_in user }
before { get :index }
it { should respond_with :success }
end
context 'if user signed out' do
before { get :index }
it { should redirect_to sign_in_path }
end
end
2
describe "GET index" do
action { get :index }
context 'if user signed in' do
before { sign_in user }
it { should respond_with :success }
end
context 'if user signed out' do
it { should redirect_to sign_in_path }
end
end