Sha256: 8d3b29962bdb1b4c0c60b3d6188e3fedaacee16bf08cbb5f6b5075768e31d998

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require "refile/test_app"

feature "Normal HTTP Post file uploads" do
  scenario "Successfully upload a file" do
    visit "/normal/posts/new"
    fill_in "Title", with: "A cool post"
    attach_file "Document", path("hello.txt")
    click_button "Create"

    expect(page).to have_selector("h1", text: "A cool post")
    click_link("Document")
    expect(page.source.chomp).to eq("hello")
  end

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

    expect(page).to have_selector(".field_with_errors")
    expect(page).to have_content("Document is too large")
  end

  scenario "Upload a file via form redisplay" do
    visit "/normal/posts/new"
    attach_file "Document", path("hello.txt")
    click_button "Create"
    fill_in "Title", with: "A cool post"
    click_button "Create"

    expect(page).to have_selector("h1", text: "A cool post")
    click_link("Document")
    expect(page.source.chomp).to eq("hello")
  end

  scenario "Format conversion" do
    visit "/normal/posts/new"
    fill_in "Title", with: "A cool post"
    attach_file "Document", path("hello.txt")
    click_button "Create"

    expect(page).to have_selector("h1", text: "A cool post")
    click_link("Convert to Upper")
    expect(page.source.chomp).to eq("HELLO")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refile-0.2.4 spec/refile/features/normal_upload_spec.rb
refile-0.2.3 spec/refile/features/normal_upload_spec.rb