I have a web request that ultimately calls an external service, merges data in our db, then presents results.
I think I can ignore a JS based setup (make request, queue job, return polling js) as it looks like I'll have the same question if this is done sync.
step "I do the thing" do
fill_in "search", with: "yarp"
VCR.use_cassette("some_cassette") do
click_on "Do the thing"
end
end
So once the server responds we get stuff in an html table and I want to make sure the content from the external service is what shows up on the page.
I found a way to grab the data from the response like this, but want to know if there is a better way to do it:
VCR.use_cassette("some_cassette") do |cassette|
interaction = cassette.serializable_hash["http_interactions"].find do |interaction|
interaction["request"]["uri"].include?("some_url")
end
@raw_result = JSON.parse(interaction["response"]["body"]["string"])
end