I am new to rspec and was wondering how could I write functional test for following two action of controller
class FeedbackFormsController < ApplicationController
before_filter :authenticate_user!
def new
@feedback_form = FeedbackForm.new
session[:return_to] = request.referer
end
def create
feedback_form = FeedbackForm.new(params[:feedback_form])
FeedbackMailer.new(feedback_form).deliver
flash[:notice] = "Your feedback was submitted successfully."
redirect_to session[:return_to]
end
end
I think it’s probably a better learning experience for you to do it yourself, but I’ll get you started with some pseudo-ish code. I will be purposely lax with my syntax.
Hopefully that should get you started.