Skip to content

Asserting on download links #283

@mattwynne

Description

@mattwynne

Hey German,

We're writing a test for a link that downloads a file. Here's what we ended up with:

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions