[rspec-users] what RSpec approach could I use for this.

Greg C. lists at ruby-forum.com
Sat Mar 3 21:55:55 UTC 2012

Background:  So I have roughly:

class A
   def calculate_input_datetimes
      # do stuff to calculate datetimes - then for each one identified
      process_datetimes(my_datetime_start, my_datetime_end)

   def process_datetimes(input_datetime_start, input_datetime_end)
      # do stuff

* I want to test that calculate_input_datetimes algorithms are working
and calculating the correct datetimes to pass to process_datetimes
* I know I can STUB out process_datetimes so that it's code won't be
involved in the test

QUESTION:  How can I setup the rspec test however so I can specifically
test that the correct datestimes were attempted to be passed over to
process_datetimes,  So for a given spec test that process_datetimes was
called three (3) times say with the following parameters passed:

* 2012-03-03T00:00:00+00:00, 2012-03-09T23:59:59+00:00
* 2012-03-10T00:00:00+00:00, 2012-03-16T23:59:59+00:00
* 2012-03-17T00:00:00+00:00, 2012-03-23T23:59:59+00:00


Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list