I am building REST API on top of a rails application. Consider the following lines: respond_to do |format| respond_to do |format| if entity.details.collect{|d| d.detail_id.to_i}.include? params["detail_id"].to_i flash["error"]=t("error_incorrect_data") format.html { redirect_to :action => "show", :id =>params["id"] and return} format.json { render :json => ''Bad Request'', :status => 400 and return} end end That is, if the request format is html(means we are being accessed through Interface), we simply redirect he user to other action and if the format is JSON, we simply return the status code along with a short message. This works as expected when accessed through cURL or any browser. But when it comes to the tests, the format.html block does not executes and as a results some of the tests start to fail. Even if you include the format parameter along with the request in the tests, even then that does not work. How should I get around it? Regards, Mohsin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---