के साथ नियंत्रक में परीक्षण आवृत्ति चर परीक्षण इस तरह के नियंत्रक को देखते हुए जहां यह दृश्य द्वारा उपयोग के लिए कई उदाहरण चर बनाता है, क्या आप आम तौर पर परीक्षण करेंगे कि उनमें से प्रत्येक ठीक से सेट हो जाए? ऐसा लगता है कि आप चाहते हैं, लेकिन यह थोड़ा सा लगता है कि यह थोड़ा मुश्किल हो सकता है। सही दृष्टिकोण क्या है?आरएसपीसी
class StaffsController < ApplicationController
def index
set_index_vars
@all_staff = Staff.find_staff_for_business_all_inclusive(current_business_id)
respond_to do |format|
format.html { render :action => "index", :locals => { :all_staff => @all_staff, :all_services => @all_services, :new_vacation => @new_vacation } }
end
end
def set_index_vars
@days_of_week = days_of_week
@first_day_of_week = DefaultsConfig.first_day_of_week
@all_services = Service.services_for_business(current_business_id)
@new_vacation = StaffVacation.new
@has_hit_staff_limit = current_user_plan.has_hit_staff_limit?
end
end
कोड भी इतने लंबे समय के रूप में आप अपने विधि के आसपास अच्छा कवरेज https://gist.github.com/1018190