Rspec: How to test create action in controller

Renders and redirects in Rails do not trigger a halt on the http stack so you need to trigger the halt yourself inside of the action by using "return render :blah" in your if or "return redirect_to :back". What I am saying is if you have a conditional and you render and then have another render it will trigger a double render because it does not halt the http and render or redirect, it continues to let you finish your job if you need to... such as closing off connections and what-have-you. An example:

MyController < ApplicationController   def my_action      redirect_to :back unless params["blah"] == "blah"      render :my_template   end end

Should be:

MyController < ApplicationController   def my_action      return redirect_to :back unless params["blah"] == "blah"      render :my_template   end end

To add before somebody points it out, I would never personally write a simple method like that, I would instead prefer to do something like:

MyController < ApplicationController   def my_action     prams["blah"] == "blah" ? render(:my_template) : redirect_to(:back)   end end