Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to deal with dates #84

Open
sckott opened this issue Jan 4, 2019 · 4 comments
Open

how to deal with dates #84

sckott opened this issue Jan 4, 2019 · 4 comments
Labels

Comments

@sckott
Copy link
Collaborator

sckott commented Jan 4, 2019

e.g.,

vcr::use_cassette("foobar", {
  a_date <- format(Sys.Date() - 1, "%Y-%m-%dT%H:%M:%S+00:00")
  aa <- wm_records_date(a_date)
  expect_is(aa, "data.frame")
})

works fine on the date its run, but then e.g., the next day it's run the date generated in Sys.Date() will be the next day, and then vcr will error and complain that the request doesn't match the fixture in foobar.

vcr/vcr#154 either 1) before_record/before_playback hooks or 2) custom request matcher

@sckott sckott added the hooks label Jan 4, 2019
@sckott
Copy link
Collaborator Author

sckott commented Feb 9, 2019

working on this in this pkg https://github.com/ropenscilabs/timefuzz

@maelle
Copy link
Member

maelle commented Nov 19, 2020

that's interesting, what's the status on this?

@sckott
Copy link
Collaborator Author

sckott commented Nov 19, 2020

timefuzz and clock are still in development - working for the most part BUT the problem is that monkey patching in R is not allowed, so to be able to mock time you'd have to import, or at least suggest, clock and maybe timefuzz too - some may not want to add additional imports just to mock time, but some will

@maelle
Copy link
Member

maelle commented Nov 20, 2020

Yeah I suppose that depending on the requests a package makes, mocking time might be crucial!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants