> What do you pass to get_work_week_date_range? Is it a string? Or an
> instance of Date? Or Time?
I pull the date in from the params hash, and immediately parse it to a
Date:
Date.parse(params[:date]) rescue Date.today
> If it worked once it should always work. Which suggests that maybe
> you're passing in something different from time to time? One time a
> Date, one time a Time?
You're right, that's why I've pounded my head against the wall for a
week!
This method is only called from one other method, and I've extracted
it really only for testing.
> Put together a test and explicitly pass the *same* argument (class and
> value) and see if you can duplicate it.
All tests pass :(
it "should know how to get the week based on a date" do
TimeCard.get_work_week_date_range(Date.parse("2008-08-05")).should
== [Date.parse("2008-08-03"), Date.parse("2008-08-09")]
TimeCard.get_work_week_date_range(Date.parse("2008-01-01")).should
== [Date.parse("2007-12-30"), Date.parse("2008-01-05")]
TimeCard.get_work_week_date_range(Date.parse("2008-02-29")).should
== [Date.parse("2008-02-24"), Date.parse("2008-03-01")]
TimeCard.get_work_week_date_range(Date.parse("2007-02-28")).should
== [Date.parse("2007-02-25"), Date.parse("2007-03-03")]
end
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---