Sha256: 627b7174ef315ac439fdee4159c2072067cfdf5fdbb4629580c601ef51a7c84b

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

require "defile/test_app"

feature "Direct HTTP post file uploads", :js do
  scenario "Successfully upload a file" do
    visit "/presigned/posts/new"
    fill_in "Title", with: "A cool post"
    attach_file "Document", path("hello.txt")

    expect(page).to have_content("Upload started")
    expect(page).to have_content("Upload complete token accepted")
    expect(page).to have_content("Upload success token accepted")

    click_button "Create"

    expect(page).to have_selector("h1", text: "A cool post")
    result = Net::HTTP.get_response(URI(find_link("Document")[:href])).body.chomp
    expect(result).to eq("hello")
  end

  scenario "Fail to upload a file that is too large" do
    visit "/presigned/posts/new"
    fill_in "Title", with: "A cool post"
    attach_file "Document", path("large.txt")

    expect(page).to have_content("Upload started")
    expect(page).to have_content("Upload failure too large")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
defile-0.2.1 spec/defile/features/presigned_upload_spec.rb
defile-0.2.0 spec/defile/features/presigned_upload_spec.rb