Bastien <[EMAIL PROTECTED]> writes:

> I totally agree with the ''listening to your specs" concepts and
> always divide my code into small methods easier to spec.
> Now let me get you right, here's my code :
>
> class Survey < ActiveRecord::Base
>   has_many :participants
>   ...
>   def generate_reports
>     ...
>     sub_total = sub_total(participants.reports)
>     ...
>   end
>
> protected
>
>  def sub_total(reports)
>     sub_total = 0
>     reports.collect do |report|
>       sub_total = sub_total + report.score
>     end
>    return sub_total
>  end
>
> end
>
> I m already specing the "generate_reports" methods with a mock on
> "sub_total"

Why are you mocking #sub_total?

Pat
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to