Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:32:18+00:00 2026-05-30T21:32:18+00:00

Background: So I have roughly (Ruby on Rails app) class A def calculate_input_datetimes #

  • 0

Background: So I have roughly (Ruby on Rails app)

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

   def process_datetimes(input_datetime_start, input_datetime_end)
      # do stuff
   end
end

So:

  • 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

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:32:19+00:00Added an answer on May 30, 2026 at 9:32 pm

    Sounds like you want should_receive and specifying what arguments are expected using with, for example

    a.should_receive(:process_datetimes).with(date1,date2)
    a.should_receive(:process_datetimes).with(date3,date4)
    a.calculate_input_datetimes
    

    There are more examples in the docs, for example you can use .ordered if the order of these calls is important

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I have a little video playing app with a UI inspired by the
Background I have a page on my ASP.NET MVC web app for users to
Background: We have app a, b, and plan to add more apps into this
Background: I have some existing apps in the App Store and I have just
Background I have a secured folder containing secret report files (in pdf format). Each
Background: I have a complicated class with many variables. I have a sound and
Background I have a massive db for a SharePoint site collection. It is 130GB
Background I have been asked by a client to create a picture of the
Background: I have a kubuntu laptop right now that I can't use wirelessly, i.e.
Background: we have an application that generates reports from HTML (that may or may

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.