mardi 28 juillet 2015

RSpec for a rails controller

I am new to ROR and RSpec. I have written a controller that updates staff for a student like below:

class EStudentsController < ApplicationController def allot @staff= Staff.find(params[:staff_id]) @student= Student.find(@staff.staff_id) @estaffforstudent= EStaffStudent.find(params[:student_id]) @estaffforstudent.staff_id = @staff.id @estaffforstudent.save redirect_to [@student, @staff] end

How do I write RSpec for the above? Some examples with study resources will be helpful.

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire