Hi friends I want to stub or/mock the normal mt=ethod in controller Can u give any idea? Example When i was testing the below code using mocks and stubs i m getting error is "Mock ''errors'' received unexpected message :each with (no args)" Could u give any idea on how to stub/mock normal methods n like chart_files_errors in below code Please give me ideas In my controller method def create @employee = Employee.new if (Employee.update_attributes(params[:emp])) xxxxxx else #XXX_method in the controoler flash[:error] = chart_files_errors(@exployee.errors) end end def chart_files_errors(@errors) errors.each do |key, error| count = count + 1 key = property_name_convert(key) if previous_error == "" previous_error = error[0] end if (previous_error == error[0]) # checking the previous error and current error if (count == errors.size) #Adding the previous error message and current error message ( Key and Error) error_message = (error_message + " #{key.capitalize} #{error[0]}") else #Adding the previous error message and current error message ( Key only) error_message = (error_message + " #{key.capitalize}" + ",") end # end of ((count == errors.size) else error_message = error_message + " #{previous_error} , #{key.capitalize} #{error[0]}" end # end of (pre_value == error[0]) end # errors loop error_message end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---