Sha256: b4168edc5987caac1c03b133cd36782df8f13bab3ac1c3d06f77d1142eb76922

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

require "refile/test_app"

feature "Direct HTTP post file uploads", :js do
  scenario "Successfully upload a file" do
    visit "/direct/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 success")
    expect(page).to have_content("Upload complete")

    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 "/direct/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 error")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refile-0.3.0 spec/refile/features/direct_upload_spec.rb
refile-0.2.5 spec/refile/features/direct_upload_spec.rb
refile-0.2.4 spec/refile/features/direct_upload_spec.rb
refile-0.2.3 spec/refile/features/direct_upload_spec.rb
refile-0.2.2 spec/refile/features/direct_upload_spec.rb