Hey German,
We're writing a test for a link that downloads a file. Here's what we ended up with:
It would be ideal if we could do something more like:
visit(~"/jobs/dajob/packets/#{packet}")
|> click_link("Download")
|> assert_downloaded(:json, Jason.encode!(packet), filename: "my-packet.json")
What do you reckon? I realize it's switching paradigm from live view to more traditional controller request/response. We tried using unwrap but weren't sure how to do it with the view that you get from that.
I'd be happy to spend some time trying to factor an assert_downlaoded out of our code if you think it would be useful and have some tips about what it would look like.
Hey German,
We're writing a test for a link that downloads a file. Here's what we ended up with:
It would be ideal if we could do something more like:
What do you reckon? I realize it's switching paradigm from live view to more traditional controller request/response. We tried using
unwrapbut weren't sure how to do it with theviewthat you get from that.I'd be happy to spend some time trying to factor an
assert_downlaodedout of our code if you think it would be useful and have some tips about what it would look like.