0

I am using the webmock gem to stub requests for rspec tests.

One of my requests makes a request to a microservice that includes a type and a timestamp in the address:

e.g. www.microservice.com/type=1?timestamp=1521493200

I can stub the type easily, but I cannot stub the timestamp because it constantly changes based on the code. How can I stub this request?

Rachel
  • 157
  • 2
  • 8

1 Answers1

1

You can use a regular expression e.g. stub_request(:get, /www.microservice.com\/type=1\?timestamp=\d+/)

Bartosz Blimke
  • 6,498
  • 3
  • 24
  • 19